/// <summary> /// /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> private void Playing(GameTime gameTime, KeyboardState keyboardState) { lastPause += gameTime.ElapsedGameTime.Milliseconds; //Check for pause if (keyboardState.IsKeyDown(Keys.Escape) && lastPause > PauseDelay) { gameState = GameState.Paused; lastPause = 0; } //Check if exit was reached if (level.ReachedExit && levelIndex < numLevels) { levelIndex++; level = new Level(Services, levelIndex); } else if (levelIndex >= numLevels && level.ReachedExit) { gameState = GameState.GameOver; } //Check if player is out of lives if (level.Player.Lives <= 0) { gameState = GameState.GameOver; } level.Update(gameTime, Keyboard.GetState()); hud.Update(gameTime, level); }