//Called when the game ends void StateToEnd() { if (myState == GameState.InGame) //Check for when it is not called in game { myState = GameState.EndGame; //Changing the state to go to the score screen WAM_ScoreService.SubmitScore(PlayerScore); //We submit our score to for high score resetMoles(); //clear the field for neetness. } }
public Text HighScoreTextElement; //The all time high score //When this script is enabled, it means this screen has popped up and we need to update its info private void OnEnable() { //If we forgot to set the game manager, we find one ourself if (GameManager == null) { GameManager = GameObject.FindObjectOfType <WAM_GameManager>(); } //If we have a game manager and the right UI elements, we can transfer the scores on screen if (GameManager != null && PlayerScoreTextElement != null) { PlayerScoreTextElement.text = "Your score this game was: " + GameManager.PlayerScore; } if (HighScoreTextElement != null) { HighScoreTextElement.text = "The overall high-score currently is: " + WAM_ScoreService.GetHighScore(); } }