Exemple #1
0
		//ncrunch: no coverage end

		private void InitGame()
		{
			Show();
			if (menu != null)
				menu.Hide();
			if (restartCommand != null && restartCommand.IsActive)
				restartCommand.Dispose(); //ncrunch: no coverage
			if (backToMenuCommand != null && backToMenuCommand.IsActive)
				backToMenuCommand.Dispose(); //ncrunch: no coverage
			if (gameOverMessage != null)
				gameOverMessage.Dispose(); //ncrunch: no coverage
			score = new Score();
			currentLevel = new Level(score);
			ball = new BallInLevel(new Paddle(), currentLevel);
			new UI(window, this);
			//ncrunch: no coverage start
			score.GameOver += () =>
			{
				RemoveOldObjects();
				gameOverMessage = new FontText(Font.Default, "That's it.\nGame Over!\n\nPress \"Q\" to " +
					"go back to the Main Menu.", Rectangle.One);
				restartCommand = new Command(InitGame).Add(new KeyTrigger(Key.Space)).
					Add(new MouseButtonTrigger()).Add(new TouchTapTrigger());
				backToMenuCommand = new Command(BackToMainMenu).Add(new KeyTrigger(Key.Q));
			};
			//ncrunch: no coverage end
			Score = score;
		}
Exemple #2
0
        //ncrunch: no coverage end

        private void InitGame()
        {
            Show();
            if (menu != null)
            {
                menu.Hide();
            }
            if (restartCommand != null && restartCommand.IsActive)
            {
                restartCommand.Dispose();                 //ncrunch: no coverage
            }
            if (backToMenuCommand != null && backToMenuCommand.IsActive)
            {
                backToMenuCommand.Dispose();                 //ncrunch: no coverage
            }
            if (gameOverMessage != null)
            {
                gameOverMessage.Dispose();                 //ncrunch: no coverage
            }
            score        = new Score();
            currentLevel = new Level(score);
            ball         = new BallInLevel(new Paddle(), currentLevel);
            new UI(window, this);
            //ncrunch: no coverage start
            score.GameOver += () =>
            {
                RemoveOldObjects();
                gameOverMessage = new FontText(Font.Default, "That's it.\nGame Over!\n\nPress \"Q\" to " +
                                               "go back to the Main Menu.", Rectangle.One);
                restartCommand = new Command(InitGame).Add(new KeyTrigger(Key.Space)).
                                 Add(new MouseButtonTrigger()).Add(new TouchTapTrigger());
                backToMenuCommand = new Command(BackToMainMenu).Add(new KeyTrigger(Key.Q));
            };
            //ncrunch: no coverage end
            Score = score;
        }