Ejemplo n.º 1
0
        protected override void Update(TimeSpan gameTime)
        {
            inputService = WaveServices.Input;

            if (inputService.KeyboardState.IsConnected)
            {
                // Key F1
                if (inputService.KeyboardState.F1 == ButtonState.Pressed &&
                    beforeKeyboardState.F1 != ButtonState.Pressed)
                {
                    this.diagnostics = !this.diagnostics;
                    WaveServices.ScreenContextManager.SetDiagnosticsActive(this.diagnostics);
                    this.Scene.RenderManager.DebugLines = this.diagnostics;
                }
                // Key F5
                else if (this.sceneState != SceneState.EMITER &&
                         inputService.KeyboardState.F5 == ButtonState.Pressed &&
                         beforeKeyboardState.F5 != ButtonState.Pressed)
                {
                    this.RemoveBeforeBehaviors();

                    MyScene scene = this.Scene as MyScene;
                    scene.CreateEmiterBox();
                    this.sceneState = SceneState.EMITER;
                }
                // Key F6
                else if (this.sceneState != SceneState.WALL &&
                         inputService.KeyboardState.F6 == ButtonState.Pressed &&
                         beforeKeyboardState.F6 != ButtonState.Pressed)
                {
                    this.RemoveBeforeBehaviors();

                    MyScene scene = this.Scene as MyScene;
                    scene.CreateBoxStack();
                    this.sceneState = SceneState.WALL;
                }
                // Key F7
                else if (this.sceneState != SceneState.BRIDGE &&
                         inputService.KeyboardState.F7 == ButtonState.Pressed &&
                         beforeKeyboardState.F7 != ButtonState.Pressed)
                {
                    this.RemoveBeforeBehaviors();

                    MyScene scene = this.Scene as MyScene;
                    scene.CreateBridge();
                    this.sceneState = SceneState.BRIDGE;
                }
                // Key G
                else if (inputService.KeyboardState.G == ButtonState.Pressed &&
                         beforeKeyboardState.G != ButtonState.Pressed)
                {
                    gravityIndex++;
                    this.Scene.PhysicsManager.Gravity3D = gravities[gravityIndex % gravities.Length];
                }
                // Key H
                else if (inputService.KeyboardState.H == ButtonState.Pressed &&
                         beforeKeyboardState.H != ButtonState.Pressed)
                {
                    MyScene scene = this.Scene as MyScene;
                    scene.helpText.Entity.Enabled = !scene.helpText.Entity.Enabled;
                }
            }

            beforeKeyboardState = inputService.KeyboardState;
        }