void Start() { if (checkpoints.Count == 0) { return; } allRacerArray = FindObjectsOfType <Object> ().Where(x => x is IRacer).ToArray(); //If playerTwo is turned off, then need to remove player two from the above array. GameObject controllerObject = GameObject.FindWithTag("MetaGameController"); controller = (UI.MetaGameController)controllerObject.GetComponent(typeof(UI.MetaGameController)); if (controller.GetTwoPlayer() == false) { RemovePlayerTwo(); } for (int i = 0; i < allRacerArray.Length; i++) { IRacer racer = allRacerArray[i] as IRacer; m_RacerNextCheckpoints.Add(racer, checkpoints[0]); racer.DisableControl(); } }
void Awake() { //Destroy Player two unless it is enabled. if (this.tag.Equals("PlayerTwo")) { GameObject controllerObject = GameObject.FindWithTag("MetaGameController"); UI.MetaGameController controller = (UI.MetaGameController)controllerObject.GetComponent(typeof(UI.MetaGameController)); if (controller.GetTwoPlayer() == false) { Destroy(this.gameObject); } } }