/// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager screenManager, bool loadingIsSlow,
                                PlayerIndex? controllingPlayer,
                                params GameScreen[] screensToLoad)
        {
            // Tell all the current screens to transition off.
            foreach (GameScreen screen in screenManager.GetScreens())
                screen.ExitScreen();

            // Create and activate the loading screen.
            LoadingScreen loadingScreen = new LoadingScreen(screenManager,
                                                            loadingIsSlow,
                                                            screensToLoad);

            screenManager.AddScreen(loadingScreen, controllingPlayer);
        }
 /// <summary>
 /// Shows a message box with the current level. Used when level is increased and decreased
 /// </summary>
 private void DisplayLevelMessage()
 {
     ScreenManager.AddScreen(new MessageBoxScreen("Level " + currentLevel + "\r\nPress enter to continue", false), ControllingPlayer);
 }
 /// <summary>
 /// Ends the current game and returns to the main menu.
 /// </summary>
 public void GameOver()
 {
     isGameOver = true;
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen());
     ScreenManager.AddScreen(new GameOverScreen(), ControllingPlayer);
 }
 /// <summary>
 /// User has won the game, show a "You won!" message and return to the main menu
 /// </summary>
 private void WonTheGame()
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen());
     ScreenManager.AddScreen(new WonGameScreen(), ControllingPlayer);
 }
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            KeyboardState keyboardState = Keyboard.GetState();
            MouseState    mouseState    = Mouse.GetState();

            if (input.IsPauseGame(ControllingPlayer))
            {
                ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);
            }
            else
            {
                if (!piranha.IsInvul)
                {
                    #region Keyboard toggle keys
                    if (keyboardState.IsKeyDown(Keys.R) && prevKeyboard.IsKeyUp(Keys.R))
                    {
                        ResetGame();
                    }
                    if (keyboardState.IsKeyDown(Keys.M) && prevKeyboard.IsKeyUp(Keys.M))
                    {
                        canUseMouse = !canUseMouse;
                    }
                    if (keyboardState.IsKeyDown(Keys.G) && prevKeyboard.IsKeyUp(Keys.G))
                    {
                        godMode = !godMode;
                    }
                    #endregion

                    #region Mouse control
                    if (canUseMouse)
                    {
                        // Mouse control, can travel in all directions
                        Vector2 mousePos    = new Vector2(mouseState.X, mouseState.Y);
                        Vector2 oldMousePos = new Vector2(prevMouse.X, prevMouse.Y);
                        if (mousePos != oldMousePos)
                        {
                            piranha.WantedPosition = new Vector2(mouseState.X, mouseState.Y);
                        }
                    }
                    #endregion

                    #region Keyboard directional control keys
                    if (keyboardState.IsKeyDown(Keys.Up))
                    {
                        piranha.WantedPosition += new Vector2(0, -18);
                    }
                    else if (keyboardState.IsKeyDown(Keys.Down))
                    {
                        piranha.WantedPosition += new Vector2(0, 18);
                    }
                    else if (keyboardState.IsKeyDown(Keys.Left))
                    {
                        piranha.WantedPosition += new Vector2(-18, 0);
                    }
                    else if (keyboardState.IsKeyDown(Keys.Right))
                    {
                        piranha.WantedPosition += new Vector2(18, 0);
                    }
                    #endregion

                    // Clamp the wanted position to the screen bounds (with a little leeway)
                    piranha.WantedPosition = new Vector2(
                        MathHelper.Clamp(piranha.WantedPosition.X, -30, Functions.GameSize.X + 30),
                        MathHelper.Clamp(piranha.WantedPosition.Y, -30, Functions.GameSize.Y + 30));
                }
            }

            prevKeyboard = keyboardState;
            prevMouse    = mouseState;
        }