Exemplo n.º 1
0
    /// <summary>
    /// This manages the scores when the game has ended. Updating leaderboards and checking achievements
    /// and displaying the correct text on the game over screen.
    /// </summary>
    public void gameOverScoreManagement()
    {
        leaderboards.updateHighScoreLeaderboard((long)score);
        leaderboards.updateSwishHighScoreLeaderboard((long)swishesScored);
        leaderboards.updateHoopHighScoreLeaderboard((long)hoopsScored);
        bool isHighScore = false;
        bool isSwishBest = false;
        bool isHoopBest  = false;

        achievements.CheckScoreAchievements(score);
        if (score > highScore)
        {
            isHighScore = true;
            uiManager.updateHighScoreText(score);
            PlayerPersistence.SetHighScore(score);
        }
        if (swishesScored > swishBest)
        {
            isSwishBest = true;
            PlayerPersistence.SetSwishHighScore(swishesScored);
        }
        if (hoopsScored > hoopBest)
        {
            isHoopBest = true;
            PlayerPersistence.SetHoopHighScore(hoopsScored);
        }

        uiManager.OpenGameLostPanel();
        uiManager.displayFinalScore(score, isHighScore);
        uiManager.displaySwishFinalScore(swishesScored, isSwishBest);
        uiManager.displayHoopFinalScore(hoopsScored, isHoopBest);
    }