Graphics Reference
In-Depth Information
UpdateBattleState() is this script's equivalent to UpdateRaceState() in the Metal Vehicle
Doom game. It sets battleRunning to whatever Boolean value is passed in as a parameter:
public void UpdateBattleState( bool aState )
{
battleRunning= aState;
}
13.6 Global Battle Manager
The battle controller script manages data for each player and registers itself with the global
battle manager as it instantiates. The global battle manager takes care of managing the
bigger picture, dealing with comparing players to calculate score board positions and
keeping tabs on the global race state.
The GlobalBattleManager.cs script in full:
using UnityEngine;
using System.Collections;
public class GlobalBattleManager : ScriptableObject
{
private int currentID;
private Hashtable battleControllers;
private Hashtable battlePositions;
private Hashtable battleFinished;
private Hashtable sortedPositions;
private int numberOfBattlers;
private int myPos;
private bool isAhead;
private BattleController tempRC;
private BattleController focusPlayerScript;
private bool battleRunning;
private static GlobalBattleManager instance;
public static GlobalBattleManager Instance
{
get
{
if (instance == null)
{
instance =
ScriptableObject.CreateInstance
<GlobalBattleManager>();
}
return instance;
}
}
public void OnApplicationQuit ()
{
instance = null;
}
Search WWH ::




Custom Search