public void SelectLevel(int index) { if (GlobalModel.Progress.GetCurrentChapter().Levels[index].IsLocked) { return; } GlobalModel.CurrentLevelIndex.Value = index; GlobalModel.Save(); LoadDashboardScene(); }
private void OnPlayerLost() { isLevelFinished = true; // Earn gold only GlobalModel.Gold.Value += Score.Value; GlobalModel.Save(); GameEnvironment.Pause(); var args = new PlayerLostEventArgs { GoldEarned = Score.Value, CornEarned = 0 }; if (PlayerLost != null) { PlayerLost(this, args); } }
private void OnPlayerWonLevel() { isLevelFinished = true; // Earn gold and corn GlobalModel.Gold.Value += Score.Value; GlobalModel.Corn.Value += cornForCompletedLevel; GlobalModel.Save(); GameEnvironment.Pause(); var args = new PlayerWonLevelEventArgs { GoldEarned = Score.Value, CornEarned = cornForCompletedLevel }; if (PlayerWonLevel != null) { PlayerWonLevel(this, args); } }
private void OnApplicationQuit() { GlobalModel.Save(); }