示例#1
0
    void InitializeVariable()
    {
        if (!PlayerPrefs.HasKey("Game Initialized"))
        {
            GamePrefences.SetEasyDifficultyState(0);
            GamePrefences.SetHardDifficultyCoinScore(0);
            GamePrefences.SetEasyDifficultyHighscore(0);

            GamePrefences.SetMediumDifficultyState(1);
            GamePrefences.SetMediumDifficultyCoinScore(0);
            GamePrefences.SetMediumDifficultyHighscore(0);

            GamePrefences.SetHardDifficultyState(1);
            GamePrefences.SetHardDifficultyCoinScore(0);
            GamePrefences.SetHardDifficultyCoinScore(0);

            GamePrefences.SetMusicState(0);

            PlayerPrefs.SetInt("Game Initialized", 123);
        }
    }
示例#2
0
    public void CheckGameStatus(int score, int coinScore, int lifeScore)
    {
        Debug.Log("Chech game status");
        if (lifeScore < 0)
        {
            Debug.Log("LifeSCore<2");
            if (GamePrefences.GetEasyDifficultyState() == 1)
            {
                Debug.Log("GetEasyLevel");
                int highScore     = GamePrefences.GetEasyDifficultyHighscore();
                int coinHighScore = GamePrefences.GetEasyDifficultyCoinScore();
                if (highScore < score)
                {
                    Debug.Log("Score");
                    GamePrefences.SetEasyDifficultyHighscore(score);
                }
                if (coinHighScore < coinScore)
                {
                    Debug.Log("CoinScore");
                    GamePrefences.SetEasyDifficultyCoinScore(coinScore);
                }
            }
            if (GamePrefences.GetMediumDifficultyState() == 1)
            {
                Debug.Log("MediumLevel");
                int highScore     = GamePrefences.GetMediumDifficultyHighscore();
                int coinHighScore = GamePrefences.GetMediumDifficultyCoinScore();

                if (highScore < score)
                {
                    Debug.Log("7");
                    GamePrefences.SetMediumDifficultyHighscore(score);
                }
                if (coinHighScore < coinScore)
                {
                    //  Debug.Log("8");
                    GamePrefences.SetMediumDifficultyCoinScore(coinScore);
                }
            }
            if (GamePrefences.GetHardDifficultyState() == 1)
            {
                Debug.Log("HardLevel");
                int highScore     = GamePrefences.GetHardDifficultyHighscore();
                int coinHighScore = GamePrefences.GetHardDifficultyCoinScore();

                if (highScore < score)
                {
                    //    Debug.Log("10");
                    GamePrefences.SetHardDifficultyHighscore(score);
                }
                if (coinHighScore < coinScore)
                {
                    //  Debug.Log("11");
                    GamePrefences.SetHardDifficultyCoinScore(coinScore);
                }
            }
            gameStartedFromMainMenu     = false;
            gameRestartedAfterPlayerDie = false;

            GamePlyControllar.instance.gameOverShowpenal(score, coinScore);
        }
        else
        {
            //debug.Log("12");
            this.score     = score;
            this.coinScore = coinScore;
            this.lifeScore = lifeScore;

            //GamePlyControllar.instance.SetScore(score );
            //GamePlyControllar.instance.SetCoinScore(coinScore );
            //GamePlyControllar.instance.SetLifeScore(lifeScore );

            gameStartedFromMainMenu     = false;
            gameRestartedAfterPlayerDie = true;
            GamePlyControllar.instance.PlayerDiedRestartedgame();
        }
    }