コード例 #1
0
        private void UpdateInput()
        {
            if (UpButton.Down())
            {
                Physics.Thrust(_FLYSPEED);
            }
            else if (DownButton.Down())
            {
                Physics.Thrust(-_FLYSPEED);
            }

            if (LeftButton.Down())
            {
                Physics.AddAngularForce(-_TURNSPEED);
            }
            else if (RightButton.Down())
            {
                Physics.AddAngularForce(_TURNSPEED);
            }

            if (LookAnalog.Position != Vector2.Zero)
            {
                Body.Angle = Physics.GetAngle(new Vector2(-LookAnalog.Position.X, -LookAnalog.Position.Y));
            }

            if (ThrustTrigger.Value > ThrustTrigger.DeadZone)
            {
                Physics.Thrust(ThrustTrigger.Value * _FLYSPEED);
            }

            if (FireButton.RapidFire(250))
            {
                Gun.Fire();
            }
        }
コード例 #2
0
 public override void Update(GameTime gt)
 {
     base.Update(gt);
     if (_up.Down())
     {
         _camera.Position.Y -= 1f;
     }
     else if (_down.Down())
     {
         _camera.Position.Y += 1f;
     }
     if (_left.Down())
     {
         _camera.Position.X -= 1f;
     }
     else if (_right.Down())
     {
         _camera.Position.X += 1f;
     }
     if (_zoomIn.Down())
     {
         _camera.Zoom += .1f;
     }
     else if (_zoomOut.Down())
     {
         _camera.Zoom -= .1f;
     }
 }