public void Show()
    {
        menuUI.SetActive(true);
        Time.timeScale = 0f;

        int    bonus      = timeHandler.GetBonusScore();
        int    totalScore = PlayerStats.score + bonus;
        string msg        = "";

        if (totalScore > PlayerPrefs.GetInt("highscore"))
        {
            msg += "New highscore!\n";
            PlayerPrefs.SetInt("highscore", totalScore);
        }
        uiTextScore.text = string.Format("Bonus: {0}\n", bonus) +
                           string.Format("Total score: {0}\n", totalScore);
    }
Exemple #2
0
    public void LevelComplete()
    {
        menuUI.SetActive(true);
        Time.timeScale = 0f;

        PlayerController.SaveStaticVariables();
        ScoreHandler.SaveStaticVariables();
        LevelHandler.SaveStaticVariables();
        PlayerStats.score += bonus;

        string scene = SceneManager.GetActiveScene().name;

        level = scene[scene.Length - 1].ToString();
        bonus = timeHandler.GetBonusScore();

        uiTextTitle.text = string.Format("Level {0} complete\n", level);
        uiTextScore.text = string.Format("Bonus: {0}\n", bonus) +
                           string.Format("Total score: {0}", PlayerStats.score);
    }