Graphics Reference
In-Depth Information
public void StartBattle()
{
battleRunning=true;
UpdateBattleStates();
}
public void StopBattle()
{
// we don't want to keep calling everyone to tell them about
// the battle being over if we've already done it once, so
// check first battleRunning is true
if(battleRunning==true)
{
// set a flag to stop repeat calls etc.
battleRunning=false;
// tell everyone about the update to the state of
// battleRunning
UpdateBattleStates();
// tell all players that we're done, by sending a
// message to each gameObject with a battle
// controller attached to it
// to call the PlayerFinishedBattle() function in
// the car control script
for ( int b = 1; b <= numberOfBattlers; b++ )
{
tempRC = (BattleController) battleControllers
[b];
tempRC.gameObject.SendMessage("PlayerFinished
Battle",SendMessageOptions.DontRequireReceiver);
}
}
}
public void RegisterFrag( int whichID )
{
focusPlayerScript= (BattleController)
battleControllers[whichID];
focusPlayerScript.FraggedOther();
}
void UpdateBattleStates()
{
for ( int b = 1; b <= numberOfBattlers; b++ )
{
tempRC = (BattleController) battleControllers [b];
tempRC.UpdateBattleState(battleRunning);
}
}
}
13.6.1 Script Breakdown
This global battle manager is, again, very similar to the global race manager from the Metal
Vehicle Doom game we looked at in Chapter 12. For that reason, I will highlight and run
Search WWH ::




Custom Search