public void WaitGameOver() { if (PlayerLife > 0) { PlayerLife--; ui.SetPlayerLife(PlayerLife); player.transform.position = Vector3.zero; player.gameObject.SetActive(true); hazardRoutine = StartCoroutine(Hazards()); } else { for (int i = 0; i < BGs.Length; i++) { BGs[i].StopScroll(); } ui.SetGameOver(); IsGameOver = true; } }
// Use this for initialization void Start() { IsGameOver = false; IsBossAlive = false; player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); PlayerLife = DefaultPlayerLife - 1; hazardRoutine = StartCoroutine(Hazards()); for (int i = 0; i < BGs.Length; i++) { BGs[i].StartScroll(); } Score = 0; ui = GameObject.FindGameObjectWithTag("UI").GetComponent <MainUIController>(); ui.SetScore(Score); ui.SetPlayerLife(PlayerLife); currentStageNumber = 1; }