Пример #1
0
 // метод, отвечающий за старт игры
 private void StartGame()
 {
     currentLevel = GetCurrentLevel();
     LoadCurrentLevel(currentLevel);
     Cursor.Position = GetStartPosition(currentLevel);
     AddEventsMouseEnter(currentLevel);
     PlaySound.PlayMusic(Sound.start);
 }
Пример #2
0
 private void restartGame()
 {
     PlaySound.PlayMusic(Sound.fail);
     if (MessageBox.Show("Вы проиграли! Ещё разок?", "Неудача...", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
     {
         StartGame();
     }
     else
     {
         this.Close();
     }
 }
Пример #3
0
 private void finishGame()
 {
     numberCurrentLevel++;
     if (numberCurrentLevel == listLevelType.Count)
     {
         PlaySound.PlayMusic(Sound.victory);
         MessageBox.Show("Вы прошли лабиринт! Поздравляю!!!");
         this.Close();
     }
     else
     {
         PlaySound.PlayMusic(Sound.finish);
         MessageBox.Show("Уровень пройден!");
         StartGame();
     }
 }
Пример #4
0
        private void checkKey(object sender)
        {
            Key _key = (Key)(from key in currentLevel.Controls.Cast <UserControl>()
                             where key is Key && key.BackColor == (sender as Door).BackColor
                             select key).FirstOrDefault();

            if (_key.Visible)
            {
                restartGame();
            }
            else
            {
                PlaySound.PlayMusic(Sound.key);
                (sender as Door).Visible = false;
            }
        }
Пример #5
0
 private void control_MouseEnter(object sender, EventArgs e)
 {
     if (sender is Wall || sender is Flashing_wall)
     {
         restartGame();
     }
     if (sender is Finish)
     {
         finishGame();
     }
     if (sender is Key)
     {
         (sender as Key).Visible = false;
         PlaySound.PlayMusic(Sound.key);
     }
     if (sender is Door)
     {
         checkKey(sender);
     }
     if (sender is Ice)
     {
         DanceMouse();
     }
 }