Beispiel #1
0
        private void OnKeyDown(Key key)
        {
            this.Velocity = new Vector3D(0, 0, 0);

            if (GameInput.IsKeyDown(Key.W))
            {
                this.Velocity += this.front * this.speed;
            }
            if (GameInput.IsKeyDown(Key.S))
            {
                this.Velocity += -this.front * this.speed;
            }
            if (GameInput.IsKeyDown(Key.A))
            {
                this.Velocity += -this.right * this.speed;
            }
            if (GameInput.IsKeyDown(Key.D))
            {
                this.Velocity += this.right * this.speed;
            }

            this.camera.Transform = this.transform;
        }
Beispiel #2
0
 private void OnKeyUp(Key key)
 {
     if (!GameInput.IsKeyDown(Key.W) && !GameInput.IsKeyDown(Key.S) && !GameInput.IsKeyDown(Key.A) && !GameInput.IsKeyDown(Key.D))
     {
         this.Velocity = new Vector3D(0, 0, 0);
     }
 }