示例#1
0
        protected override void OnKeyDown(KeyboardKeyEventArgs e)
        {
            base.OnKeyDown(e);

            // camera position
            if (e.Key == Key.Up)
            {
                camera.MoveForward();
            }
            else if (e.Key == Key.Down)
            {
                camera.MoveBackward();
            }
            else if (e.Key == Key.Left)
            {
                camera.MoveLeft();
            }
            else if (e.Key == Key.Right)
            {
                camera.MoveRight();
            }
            else if (e.Key == Key.B)
            {
                if (blinn == 0)
                {
                    blinn = -1;
                }
                else
                {
                    blinn = 0;
                }
            }
        }
示例#2
0
        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (InputHandler.IsActionPressed("Forward"))
            {
                Camera.MoveForward(10f);
            }

            if (InputHandler.IsActionPressed("Backward"))
            {
                Camera.MoveBackward(10f);
            }

            if (InputHandler.IsActionPressed("Left"))
            {
                Camera.StrafeLeft(10f);
            }

            if (InputHandler.IsActionPressed("Right"))
            {
                Camera.StrafeRight(10f);
            }
        }