public void HardDifficulty()
    {
        JachTheGiant_GamePreferences.SetEasyDifficultyState(0);
        JachTheGiant_GamePreferences.SetMediumDifficultyState(0);
        JachTheGiant_GamePreferences.SetHardDifficultyState(1);

        easySign.SetActive(false);
        mediumSign.SetActive(false);
        hardSign.SetActive(true);
    }
 void CheckToPlayTheMusic()
 {
     if (JachTheGiant_GamePreferences.GetMusicState() == 1)
     {
         JachTheGiant_MusicController.instance.PlayMusic(true);
         musicBtn.image.sprite = musicIcons [1];
     }
     else
     {
         JachTheGiant_MusicController.instance.PlayMusic(false);
         musicBtn.image.sprite = musicIcons [0];
     }
 }
 public void MusicButton()
 {
     if (JachTheGiant_GamePreferences.GetMusicState() == 0)
     {
         JachTheGiant_GamePreferences.SetMusicState(1);
         JachTheGiant_MusicController.instance.PlayMusic(true);
         musicBtn.image.sprite = musicIcons[1];
     }
     else if (JachTheGiant_GamePreferences.GetMusicState() == 1)
     {
         JachTheGiant_GamePreferences.SetMusicState(0);
         JachTheGiant_MusicController.instance.PlayMusic(false);
         musicBtn.image.sprite = musicIcons[0];
     }
 }
 void SetScoreBasedOnDifficulty()
 {
     if (JachTheGiant_GamePreferences.GetEasyDifficultyState() == 1)
     {
         SetScore(JachTheGiant_GamePreferences.GetEasyDifficultyHighScore(), JachTheGiant_GamePreferences.GetEasyDifficultyCoinScore());
     }
     if (JachTheGiant_GamePreferences.GetMediumDifficultyState() == 1)
     {
         SetScore(JachTheGiant_GamePreferences.GetMediumDifficultyHighScore(), JachTheGiant_GamePreferences.GetMediumDifficultyCoinScore());
     }
     if (JachTheGiant_GamePreferences.GetHardDifficultyState() == 1)
     {
         SetScore(JachTheGiant_GamePreferences.GetHardDifficultyHighScore(), JachTheGiant_GamePreferences.GetHardDifficultyCoinScore());
     }
 }
Example #5
0
 void Start()
 {
     if (JachTheGiant_GamePreferences.GetEasyDifficultyState() == 1)
     {
         maxSpeed = easySpeed;
     }
     if (JachTheGiant_GamePreferences.GetMediumDifficultyState() == 1)
     {
         maxSpeed = mediumSpeed;
     }
     if (JachTheGiant_GamePreferences.GetHardDifficultyState() == 1)
     {
         maxSpeed = hardSpeed;
     }
     moveCamera = true;
 }
    void SetTheDifficulty()
    {
        if (JachTheGiant_GamePreferences.GetEasyDifficultyState() == 1)
        {
            SetInitialDifficulty("easy");
        }

        if (JachTheGiant_GamePreferences.GetMediumDifficultyState() == 1)
        {
            SetInitialDifficulty("medium");
        }

        if (JachTheGiant_GamePreferences.GetHardDifficultyState() == 1)
        {
            SetInitialDifficulty("hard");
        }
    }
    void InitializeVariables()
    {
        if (!PlayerPrefs.HasKey("Game Initialized"))
        {
            JachTheGiant_GamePreferences.SetEasyDifficultyState(0);
            JachTheGiant_GamePreferences.SetEasyDifficultyCoinScore(0);
            JachTheGiant_GamePreferences.SetEasyDifficultyHighScore(0);

            JachTheGiant_GamePreferences.SetMediumDifficultyState(1);
            JachTheGiant_GamePreferences.SetMediumDifficultyCoinScore(0);
            JachTheGiant_GamePreferences.SetMediumDifficultyHighScore(0);

            JachTheGiant_GamePreferences.SetHardDifficultyState(0);
            JachTheGiant_GamePreferences.SetHardDifficultyCoinScore(0);
            JachTheGiant_GamePreferences.SetHardDifficultyHighScore(0);

            JachTheGiant_GamePreferences.SetMusicState(0);

            PlayerPrefs.SetInt("Game Initialized", 123);
        }
    }
    public void CheckGameStatus(int score, int coinScore, int lifeScore)
    {
        if (lifeScore < 0)
        {
            if (JachTheGiant_GamePreferences.GetEasyDifficultyState() == 1)
            {
                int highScore     = JachTheGiant_GamePreferences.GetEasyDifficultyHighScore();
                int coinHighScore = JachTheGiant_GamePreferences.GetEasyDifficultyCoinScore();

                if (highScore < score)
                {
                    JachTheGiant_GamePreferences.SetEasyDifficultyHighScore(score);
                }

                if (coinHighScore < coinScore)
                {
                    JachTheGiant_GamePreferences.SetMediumDifficultyCoinScore(coinScore);
                }
            }

            if (JachTheGiant_GamePreferences.GetMediumDifficultyState() == 1)
            {
                int highScore     = JachTheGiant_GamePreferences.GetMediumDifficultyHighScore();
                int coinHighScore = JachTheGiant_GamePreferences.GetMediumDifficultyCoinScore();

                if (highScore < score)
                {
                    JachTheGiant_GamePreferences.SetMediumDifficultyHighScore(score);
                }

                if (coinHighScore < coinScore)
                {
                    JachTheGiant_GamePreferences.SetMediumDifficultyCoinScore(coinScore);
                }
            }

            if (JachTheGiant_GamePreferences.GetHardDifficultyState() == 1)
            {
                int highScore     = JachTheGiant_GamePreferences.GetHardDifficultyHighScore();
                int coinHighScore = JachTheGiant_GamePreferences.GetHardDifficultyCoinScore();

                if (highScore < score)
                {
                    JachTheGiant_GamePreferences.SetHardDifficultyHighScore(score);
                }

                if (coinHighScore < coinScore)
                {
                    JachTheGiant_GamePreferences.SetHardDifficultyCoinScore(coinScore);
                }
            }
            gameStartedFromMainMenu      = false;
            gameRestartedAfterPlayerDied = false;
            JachTheGiant_GameplayController.instance.GameOverShowPanel(score, coinScore);
        }
        else
        {
            this.score     = score;
            this.coinScore = coinScore;
            this.lifeScore = lifeScore;

            gameStartedFromMainMenu      = false;
            gameRestartedAfterPlayerDied = true;

            JachTheGiant_GameplayController.instance.PlayerDiedRestartTheGame();
        }
    }