MrGravity.ControllerControl.LeftThumbStickIsDown C# (CSharp) Méthode

LeftThumbStickIsDown() private méthode

Checks to see if the left thumbstick is currently Down
private LeftThumbStickIsDown ( bool held ) : bool
held bool Set true if this button is allowed to be held down and still respond to interaction
Résultat bool
        private bool LeftThumbStickIsDown(bool held)
        {
            GamePadState state = GamePad.GetState(ControllerIndex);

            var direction = new Vector2(0, -1);
            if (state.ThumbSticks.Left.Y < -.8f)
            {
                if (!held && direction == _joystickDirection) return false;
                if (held && direction == _joystickDirection) return true;
                if (!held && direction != _joystickDirection) { _joystickDirection = direction; return true; }
            }
            else if (state.ThumbSticks.Left.Y >= 0 && _joystickDirection == direction) { _joystickDirection = new Vector2(); return false; }

            return false;
        }