public void OnUpdate(GameTime gameTime) { ActiveWorld.Update(gameTime); _renderStatisticsOverlay.Update(gameTime); lock (_uiElements) _uiElements.ForEach(e => { if (e.IsActive) { e.Update(gameTime); } }); if (_inputSystem.Keyboard.IsKeyDown(Keys.Escape)) { _screenManager.SetScreen(typeof(MainMenuScreen), typeof(BlendTransition)); } if (_inputSystem.Keyboard.IsKeyDownOnce(Keys.L)) { _sceneRenderer.EnablePostProcessing = !_sceneRenderer.EnablePostProcessing; } if (_inputSystem.Keyboard.IsKeyDownOnce(Keys.F12)) { _showRenderStatistics = !_showRenderStatistics; if (_showRenderStatistics) { _renderStatisticsOverlay.Show(); } else { _renderStatisticsOverlay.Hide(); } } if (_inputSystem.Keyboard.IsKeyDownOnce(Keys.X) || _inputSystem.GamePad.IsButtonDownOnce(Buttons.X)) { _screenManager.SetScreen(typeof(GameMenu.GameMenuScreen)); } }
private void StartCreateNewGame() { var renderer = GameInstance.GetService <SceneRenderer>(); renderer.AddPostProcessingStep(new HorizontalBlurPostProcessingStep()); renderer.AddPostProcessingStep(new VerticalBlurPostProcessingStep()); renderer.EnablePostProcessing = false; var mainLight = renderer.CreateDirectionalLight(new Vector3(-1.5f, -1.0f, -0.5f)); mainLight.AmbientIntensity = 0.5f; mainLight.DiffuseIntensity = 0.8f; renderer.AmbientLight = new Vector4(0.7f, 0.5f, 0.5f, 1.0f); var gameModeManager = GameInstance.GetService <GameModeManager>(); var gameModes = gameModeManager.GetGameModeInfos(); gameModeManager.ActiveGameMode = gameModeManager.CreateGameMode(gameModes.First(), GameInstance); _world = new World(); _world.StartNewGameAsync(() => _overlay.Hide()); }