public void GameOver() { SetHighScore(); Text GameOverMessage = GameOverScreen.transform.GetChild(1).GetComponent <Text>(); if (PlayerScore == PlayerPrefs.GetInt("High Score") && PlayerScore != 0) { GameOverMessage.text = "HIGH SCORE!"; } else { if (PlayerScore >= 500 && PlayerScore < 1500) { GameOverMessage.text = "Not bad"; } else if (PlayerScore >= 1500 && PlayerScore < 3000) { GameOverMessage.text = "Pshttt you got lucky"; } else if (PlayerScore >= 3000) { GameOverMessage.text = "DAMN SON!"; } } PauseMenuScreen.SetActive(false); GameUIScreen.SetActive(false); GameOverScreen.SetActive(true); GameOverFlag = true; //possibly useless. Check if removing break game. }
public void ResumeGame() { PauseMenuScreen.SetActive(false); GameUIScreen.SetActive(true); Time.timeScale = 1f; PauseFlag = false; MusicSource.Play(); }
public void PauseGame() { if (!GameOverFlag) { PauseMenuScreen.SetActive(true); GameUIScreen.SetActive(false); Time.timeScale = 0f; PauseFlag = true; MusicSource.Pause(); } }
//Class Methods private void Start() { Time.timeScale = 1f; PlayerScore = 0; AsteroidShootScore = 10; AsteroidsPool = new GameObject[20]; MusicSource = GetComponent <AudioSource>(); GameOverFlag = PauseFlag = Muted = false; MusicSource.Play(); GameUIScreen.SetActive(true); GameOverScreen.SetActive(false); PauseMenuScreen.SetActive(false); //SelectBackground(); SetHighScore(); AsteroidPool(); }