Esempio n. 1
0
    private void Start()
    {
        HighScore score = SaveHighScore.LoadScore();

        highScore          = score.highScoreData;
        highScoreMain.text = highScore.ToString();
    }
Esempio n. 2
0
    void Start()
    {
        HighScore score = SaveHighScore.LoadScore();

        if (score == null)
        {
            highScore = 0;
            SaveHighScore.SaveScore(this);
        }
        FindObjectOfType <PlayerMove>().OnPlayerDeath += OnGameOver; //makes OnGameOver happen on the OnPlayerDeath event
    }
Esempio n. 3
0
    void OnGameOver()
    {
        //change the screen
        gameOverScreen.SetActive(true);
        platforms.SetActive(false);

        //loads the previous high score
        HighScore score = SaveHighScore.LoadScore();

        highScore = score.highScoreData;

        //checks to see if a new high score was reached
        if (highScore < Mathf.RoundToInt(Time.timeSinceLevelLoad))
        {
            //saves a new high score
            highScore = Mathf.RoundToInt(Time.timeSinceLevelLoad);
            SaveHighScore.SaveScore(this);
        }

        //Display score for that round
        secondsSurvivedUI.text = Mathf.RoundToInt(Time.timeSinceLevelLoad).ToString();
        //display the high score
        highScoreGameOver.text = highScore.ToString();
    }