コード例 #1
0
    private void InitializeGamePref()
    {
        if (!PlayerPrefs.HasKey("DRH Game Init 1"))
        {
            GamePeferences.SetEasyDifficulty(0);
            GamePeferences.SetEasyDiffScore(0);
            GamePeferences.SetEasyDiffCoinScore(0);
            //Default
            GamePeferences.SetMediuDifficulty(1); // true
            GamePeferences.SetMediumDiffScore(0);
            GamePeferences.SetMediumDiffCoinScore(0);

            GamePeferences.SetHardDifficulty(0);
            GamePeferences.SetHardDiffScore(0);
            GamePeferences.SetHardDiffCoinScore(0);

            GamePeferences.SetMusic(1); //on

            //Il pacalim prin salvaea de cheie
            PlayerPrefs.SetInt("DRH Game Init 1", 1);
        }
    }
コード例 #2
0
    public void CheckGameStatus(int score, int coinScore, int lifeScore)
    {
        //GameOVER
        if (lifeScore < 0)
        {
            //From Prefeences
            if (GamePeferences.GetEasyDifficulty() == 1)
            {
                int _score = GamePeferences.GetEasyDiffScore();
                int _coin  = GamePeferences.GetEasyDiffCoinScore();

                if (_score < score)
                {
                    GamePeferences.SetEasyDiffScore(score);
                }

                if (_coin < coinScore)
                {
                    GamePeferences.SetEasyDiffCoinScore(coinScore);
                }
            }

            if (GamePeferences.GetMediumDifficulty() == 1)
            {
                int _score = GamePeferences.GetMediumDiffScore();
                int _coin  = GamePeferences.GetMediumDiffCoinScore();

                if (_score < score)
                {
                    GamePeferences.SetMediumDiffScore(score);
                }

                if (_coin < coinScore)
                {
                    GamePeferences.SetMediumDiffCoinScore(coinScore);
                }
            }

            if (GamePeferences.GetHardDifficulty() == 1)
            {
                int _score = GamePeferences.GetHardDiffScore();
                int _coin  = GamePeferences.GetHardDiffCoinScore();

                if (_score < score)
                {
                    GamePeferences.SetHardDiffScore(score);
                }

                if (_coin < coinScore)
                {
                    GamePeferences.SetHardDiffCoinScore(coinScore);
                }
            }

            RestartGamePlayerDied = false;
            NewGameFomMainMenu    = false;

            GamePlayManager.Instance.GameOverShowFinalScore(coinScore, score);
        }
        else
        {//Still have lifes
            sessionScore     = score;
            sessionCoinScore = coinScore;
            sessionLifeScore = lifeScore;

            NewGameFomMainMenu    = false;
            RestartGamePlayerDied = true;

            GamePlayManager.Instance.PlayerDiedRestartGame();
        }
    }