So I’m trying to get a 3, 2, 1 GO! thing going on but It just doesn’t seem to be working, no errors just not working, any help?
private bool showCountdown;
private string countdown = "";
void Start () {
instance = this;
GameEventManager.GameStart += GameStart;
GameEventManager.GameOver += GameOver;
gameOverText.enabled = false;
}
void Update () {
if(Input.GetButtonDown("Jump")){
GetReady();
GameEventManager.TriggerGameStart();
}
if (Input.touchCount > 0){
GameEventManager.TriggerGameStart();
}
}
IEnumerator GetReady () {
showCountdown = true;
countdown = "3";
yield return new WaitForSeconds (1.5f);
countdown = "2";
yield return new WaitForSeconds (1.5f);
countdown = "1";
yield return new WaitForSeconds (1.5f);
countdown = "GO!";
yield return new WaitForSeconds (1.5f);
showCountdown = false;
countdown = "";
}
void OnGUI(){
if (showCountdown){
GUI.color = Color.red;
GUI.Box (new Rect (Screen.width / 2 - 100, Screen.width / 2, 200, 175), "GET READY");
GUI.color = Color.white;
GUI.Box (new Rect (Screen.width / 2 - 90, Screen.width / 2, 180, 140), countdown);
}
}