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 Start() { m_Input = input as IInput; m_Rigidbody = GetComponent <Rigidbody>(); m_Capsule = GetComponent <CapsuleCollider>(); m_Racer = GetComponent <IRacer>(); if (kart != null) { m_CurrentModifiers.Add((IKartModifier)kart); } if (driver != null) { m_CurrentModifiers.Add((IKartModifier)driver); } if (tires.Length > 0) { GameObject controllerObject = GameObject.FindWithTag("MetaGameController"); UI.MetaGameController controller = (UI.MetaGameController)controllerObject.GetComponent(typeof(UI.MetaGameController)); if (this.tag.Equals("Player")) { tires[controller.GetTireIDPlayerOne()].StartOnTire(this); } else if (this.tag.Equals("PlayerTwo")) { tires[controller.GetTireIDPlayerTwo()].StartOnTire(this); } } }
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); } } }