void InitializeVaribles() { if (!PlayerPrefs.HasKey("Game Initialized")) { GamePrefrences.SetEasyDifficulty(0); GamePrefrences.SetEasyDifficultyCoinScore(0); GamePrefrences.SetEasyDifficultyHighScore(0); GamePrefrences.SetMediumDifficulty(1); GamePrefrences.SetMediumDifficultyCoinScore(0); GamePrefrences.SetMediumDifficultyHighScore(0); GamePrefrences.SetHardDifficulty(0); GamePrefrences.SetHardDifficultyCoinScore(0); GamePrefrences.SetHardDifficultyHighScore(0); GamePrefrences.SetMusicState(0); PlayerPrefs.SetInt("Game Initialized", 123); } }
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(); } }