/// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
            bool coveredByOtherScreen)
            base.Update(gameTime, otherScreenHasFocus, false);
              // Gradually fade in or out depending on whether we are covered by the pause screen.
              if (coveredByOtherScreen)
            pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1);
            pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0);

              // Bail early if this isn't the active screen.
              if (!IsActive)

              Launcher launcher = simulation.Launcher;
              launcher.AdjustAngle((float)Math.PI / 64 * launcherChange.X);
              launcher.AdjustMagnitude(0.25f * launcherChange.Y);

              // Update the simulation's state.

              if (simulation.CurrentState == SimulationState.Failed) {
            MessageBoxScreen failedMessageBox = new MessageBoxScreen(TopLevel, "Level Failed. Please try again.",
                                                                 "Retry", "Main Menu", "Level Select");
            failedMessageBox.MiddleButton += MainMenuMessageBoxAccepted;
            failedMessageBox.LeftButton += ConfirmRetryBoxAccepted;
            failedMessageBox.RightButton += ConfirmLevelMessageBoxAccepted;

        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        void OnCancel()
            const string message = "Are you sure you want to exit the game?";

              MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(TopLevel, message);
              confirmExitMessageBox.RightButton += ConfirmExitMessageBoxAccepted;
        /// <summary>
        /// Event handler for when the Restart level editor menu entry is selected.
        /// </summary>
        void RestartLevelEditorMenuEntrySelected()
            string message = "Are you sure you want to restart the editor?";
              if (!EditorMode) {
            message = "Are you sure you want to go to the editor?";

              MessageBoxScreen confirmRestartLevelEditorMessageBox = new MessageBoxScreen(TopLevel, message);
              confirmRestartLevelEditorMessageBox.RightButton += ConfirmRestartLevelEditorBoxAccepted;
        /// <summary>
        /// Event handler for when the Retry Game menu entry is selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void RestartLevelMenuEntrySelected()
            // Put what happens when the person clicks retry
              const string message = "Are you sure you want to restart this level?";

              MessageBoxScreen confirmRestartLevelMessageBox = new MessageBoxScreen(TopLevel, message);
              confirmRestartLevelMessageBox.RightButton += ConfirmRestartLevelBoxAccepted;
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected()
            const string message = "Are you sure you want to quit this level?";

              MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(TopLevel, message);
              confirmQuitMessageBox.RightButton += ConfirmQuitMessageBoxAccepted;