void SetScoreBasedOnDifficulty()
    {
        if (GamePrefrences.GetEasyDifficulty() == 1)
        {
            SetScore(GamePrefrences.GetEasyDifficultyHighScore(), GamePrefrences.GetEasyDifficultyCoinScore());
        }

        if (GamePrefrences.GetMediumDifficulty() == 1)
        {
            SetScore(GamePrefrences.GetMediumDifficultyHighScore(), GamePrefrences.GetMediumDifficultyCoinScore());
        }

        if (GamePrefrences.GetHardDifficulty() == 1)
        {
            SetScore(GamePrefrences.GetHardDifficultyHighScore(), GamePrefrences.GetHardDifficultyCoinScore());
        }
    }
예제 #2
0
    public void CheckGameStatus(int score, int coinScore, int lifescore)
    {
        if (lifescore < 0)
        {
            if (GamePrefrences.GetEasyDifficulty() == 1)
            {
                int highScore     = GamePrefrences.GetEasyDifficultyHighScore();
                int coinHighScore = GamePrefrences.GetEasyDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePrefrences.SetEasyDifficultyHighScore(score);
                }
                if (coinHighScore < coinScore)
                {
                    GamePrefrences.SetEasyDifficultyCoinScore(coinScore);
                }
            }

            if (GamePrefrences.GetMediumDifficulty() == 1)
            {
                int highScore     = GamePrefrences.GetMediumDifficultyHighScore();
                int coinHighScore = GamePrefrences.GetMediumDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePrefrences.SetMediumDifficultyHighScore(score);
                }
                if (coinHighScore < coinScore)
                {
                    GamePrefrences.SetMediumDifficultyCoinScore(coinScore);
                }
            }

            if (GamePrefrences.GetHardDifficulty() == 1)
            {
                int highScore     = GamePrefrences.GetHardDifficultyHighScore();
                int coinHighScore = GamePrefrences.GetHardDifficultyCoinScore();

                if (highScore < score)
                {
                    GamePrefrences.SetHardDifficultyHighScore(score);
                }
                if (coinHighScore < coinScore)
                {
                    GamePrefrences.SetHardDifficultyCoinScore(coinScore);
                }
            }


            gameStartedFromMainMenu      = false;
            gameRestartedAfterPlayerDies = false;

            GameplayController.instance.GameoverShowPanel(score, coinScore);
        }
        else
        {
            this.score     = score;
            this.coinScore = coinScore;
            this.lifescore = lifescore;

            GameplayController.instance.SetScore(score);
            GameplayController.instance.SetCoinScore(coinScore);
            GameplayController.instance.SetLifeScore(lifescore);

            gameRestartedAfterPlayerDies = true;
            gameStartedFromMainMenu      = false;

            GameplayController.instance.PlayerDiedRestartTheGame();
        }
    }