protected override void Update(GameTime gameTime) { KeyboardState keyState = Keyboard.GetState(); //if (keyState.IsKeyDown(Keys.Escape)) // Exit(); foreach (Event ev in events) { switch (ev.EventId) { case (int)MyEvent.G_Exit: if (paused) { Exit(); } break; case (int)MyEvent.G_StartGame: if (paused) { initializeGame2(); } break; case (int)MyEvent.G_NextLevel: paused = true; canPause = false; break; case (int)MyEvent.G_NextLevel_END_OF_MUSIC: if (currentLevel == Constants.NUM_OF_LEVELS) { initializeCreditsScreen(); } else { paused = false; canPause = true; currentLevel++; monsters.Dispose(); initializeGame2(); } break; case (int)MyEvent.G_StartLevel: if (Components.Contains(levelScreen)) { Components.Remove(levelScreen); paused = false; } break; case (int)MyEvent.G_StartScreen: paused = true; initializeStartMenu(); break; case (int)MyEvent.G_CreditScreen: initializeCreditsScreen(); break; case (int)MyEvent.G_HelpScreen: initializeHelpScreen(); break; } } events.Clear(); if (delayedAction.eventHappened(gameTime, keyState.IsKeyDown(Keys.RightAlt) && keyState.IsKeyDown(Keys.Enter))) { graphics.ToggleFullScreen(); } if ((keyState.IsKeyDown(Keys.Enter) || keyState.IsKeyDown(Keys.Escape)) && gameOver) { gameOver = false; mediator.fireEvent(MyEvent.G_StartScreen); } if (delayedAction2.eventHappened(gameTime, keyState, Keys.C)) { if ((int)cameraMode == 2) { cameraMode = CameraMode.thirdPerson; ((ChaseCamera)camera).resetOffsets(); } else { cameraMode++; ((ChaseCamera)camera).setOffsetsFor1stPerson(); } } base.Update(gameTime); }