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

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

            LoadDashboardScene();
        }
Esempio n. 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);
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 4
0
 private void OnApplicationQuit()
 {
     GlobalModel.Save();
 }