Beispiel #1
0
        private void CheckIfPlayerDied()
        {
            if (game.PlayerHitPoints <= 0)
            {
                if (!gameIsTurnBased)
                {
                    StopGameClock();
                }

                DialogResult gameEnd = MessageBox.Show("You died. \n\nWould you like to restart the current level?", "c'est la vie",
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                if (gameEnd == DialogResult.No)
                {
                    Application.Exit();
                }
                else
                {
                    game.RestartLevel(random);
                    SetLevelLabel();
                    UpdateCharacters();
                    if (!gameIsTurnBased)
                    {
                        StartGameClock();
                    }
                }
            }
        }