Quote:
Originally Posted by Ataros
btw. There is a Break command there. What does it break?
|
The break statement terminates the closest enclosing loop or switch statement in which it appears. Control is passed to the statement that follows the terminated statement, if any.
Is this the break you are talking about?
Quote:
//check if there is any player inside
foreach (Player p in ps)
{
if (p != null)
{
if (p.Place() != null)
{
AiAircraft playerAircraft = (p.Place() as AiAircraft);
if (playerAircraft != null)
{
if (playerAircraft == aircraft)
{
aircraftWillBeDestroyed = false;
break;
}
}
}
}
}
|
I think the break statement will drop out of the foreach loop. As far as I can see the purpose of the code is to see if any of the planes contained in array ps have a player inside. If any of the array locations contains a player then the loop does not have to continue.
The next section of code checks 'aircraftWillBeDestroyed' if player is present then this is set to false and the section that destroys the aircraft will be skipped.
Cheers!