Exemple #1
0
        public void SelectLevel(int index)
        {
            if (GlobalModel.Progress.GetCurrentChapter().Levels[index].IsLocked)
            {
                return;
            }

            GlobalModel.CurrentLevelIndex.Value = index;
            GlobalModel.Save();

            LoadDashboardScene();
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
 private void OnApplicationQuit()
 {
     GlobalModel.Save();
 }