예제 #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();
            }
        }