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

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

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