// The first screen the player sees. Invites the player to click and displays the current high score. void introState() { // Do this when we first enter this state if (!stateReady) { foreach (GameObject X in openingScreen) // display all needed game objects { X.SetActive(true); } highScoreDisplay.text = "High Score: " + TimeTracker.formatTime(PlayerPrefs.GetFloat("HighScore")); // display high score in proper format stateReady = true; menuBGM.Play(); } // These are what get us out of the state if (Input.GetMouseButton(0) || Input.GetMouseButton(1) || Input.GetMouseButton(2)) { killIntroState(); turboMode = false; } else if (Input.GetKey(KeyCode.T)) { killIntroState(); turboMode = true; } }
// This is the screen that plays after every round. void playAgainState() { // Do this when we first enter this state. if (!stateReady) { foreach (GameObject X in endingScreen) // display all needed game objects { X.SetActive(true); } // Display player score, high score, and a notice if they beat it yourScoreDisplay.text = "Your Score: " + TimeTracker.formatTime(currentPlayerScore); // display player Score in proper format highScoreDisplay.gameObject.SetActive(true); if (currentPlayerScore > PlayerPrefs.GetFloat("HighScore")) { newHighScoreDisplay.SetActive(true); highScoreDisplay.text = "Old High Score: " + TimeTracker.formatTime(PlayerPrefs.GetFloat("HighScore")); // display high score in proper format PlayerPrefs.SetFloat("HighScore", currentPlayerScore); } else { highScoreDisplay.text = "Current High Score: " + TimeTracker.formatTime(PlayerPrefs.GetFloat("HighScore")); // display high score in proper format } // If you do good, be informed of turbo mode if (currentPlayerScore > turboNoticeThreshold) { turboNotice.SetActive(true); } menuBGM.Play(); stateReady = true; } // These are what get us out of this state. if (Input.GetMouseButton(0) || Input.GetMouseButton(1) || Input.GetMouseButton(2)) { killPlayAgainState(); turboMode = false; } else if (Input.GetKey(KeyCode.T)) { killPlayAgainState(); turboMode = true; } }