public void GameOver() { GameUi.gameObject.SetActive(false); Hero.gameObject.SetActive(false); MM.StopAllCoroutines(); MM.enabled = false; GameOverUi.SetActive(true); }
IEnumerator GameOver() { GameOverUi.SetActive(true); FinalScore = GameOverUi.GetComponentInChildren <Text>(); if (classic) { FinalScore.text = "Final score " + score; } else { FinalScore.text = score + " seconds survived"; } while (Current == GameOver) { if (EventSystem.current.currentSelectedGameObject != null && EventSystem.current.currentSelectedGameObject.name == "Restart") { if (classic) { SetState(states.Classic); } else { SetState(states.Survial); } EventSystem.current.SetSelectedGameObject(null); } else if (EventSystem.current.currentSelectedGameObject != null && EventSystem.current.currentSelectedGameObject.name == "Exit") { SetState(states.StartMenu); EventSystem.current.SetSelectedGameObject(null); } yield return(null); } FinalScore = null; GameOverUi.SetActive(false); }
// ---SetMode--------------------------------- public void SetPlayMode() { PlayUi.SetActive(true); GameOverUi.SetActive(false); SaveScore.SetActive(false); }