void OnGameOver(int coins, int score) { DiffLevel level = GetDiffLevel(); UpdateCoins(level, coins); UpdateScore(level, score); }
void UpdateCoins(DiffLevel level, int coins) { int highCoins = GetHighCoins(level); if (highCoins < coins) { SetHighScore(level, coins); } }
void UpdateScore(DiffLevel level, int score) { int highScore = GetHighScore(level); if (highScore < score) { SetHighScore(level, score); } }
int GetHighCoins(DiffLevel level) { switch (level) { case DiffLevel.Easy: return(GamePreferences.GetEasyDifficultyCoinScore()); case DiffLevel.Medium: return(GamePreferences.GetMediumDifficultyCoinScore()); case DiffLevel.Hard: return(GamePreferences.GetHardDifficultyCoinScore()); } throw new System.SystemException("unhandled level"); }
void SetHighCoins(DiffLevel level, int coins) { switch (level) { case DiffLevel.Easy: GamePreferences.SetEasyDifficultyCoinScore(coins); break; case DiffLevel.Medium: GamePreferences.SetMediumDifficultyCoinScore(coins); break; case DiffLevel.Hard: GamePreferences.SetHardDifficultyCoinScore(coins); break; default: throw new System.SystemException("unhandled level"); } }
public void SetDifficultyLevel(DiffLevel diffLevel) { if (!IsPlayGame) { switch (diffLevel) { case DiffLevel.Novice: _factorCheck = novice.difficultyLevel; break; case DiffLevel.Casual: _factorCheck = casual.difficultyLevel; break; case DiffLevel.Master: _factorCheck = master.difficultyLevel; break; } } }
void Awake(){ DL = this; }