private void levelFinished() { if (Kids.Kids.Count == 0 && CurrentLevel.Count == 0) { //nextlevel timerNewHouse.Stop(); timerNewCloud.Stop(); timerDrawing.Stop(); NextLevelWindow nextLevel = new NextLevelWindow(); if (nextLevel.ShowDialog() == DialogResult.OK) { Kids = new KidsDoc(); Bullets = new BulletsDoc(); Houses = new HousesDoc(this.Width); CurrentLevel = Levels.getNextLevel(); gameStarted = true; Houses.startMoving(); StartWindow(); } else { nextLevel = null; gameOver(); } } }
private void gameOver() { timerNewHouse.Stop(); timerDrawing.Stop(); GameOverWindow gameOver = new GameOverWindow(); writeToFile(gameOver.PlayerName, this.KidsKilled); this.KidsKilled = 0; DialogResult res=gameOver.ShowDialog(); if ( res== DialogResult.OK) { Kids = new KidsDoc(); Bullets = new BulletsDoc(); Levels = new LevelsDoc(); Houses = new HousesDoc(this.Width); CurrentLevel = Levels.getNextLevel(); gameStarted = true; Houses.startMoving(); StartWindow(); } else if(res == DialogResult.No) { Application.Exit(); } else { gameOver = null; showMainMenu(); } }