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

IsPressed() private méthode

Finds the first player index that is connected
private IsPressed ( Buttons button, bool held ) : bool
button Buttons The button.
held bool Set true if this button is allowed to be held down and still respond to interaction
Résultat bool
        private bool IsPressed(Buttons button, bool held)
        {
            var pressed = false;
            if (!_mControllerIndexSet)
            {
                if (GamePad.GetState(PlayerIndex.One).IsConnected) pressed = pressed || IsPressed(button, held, PlayerIndex.One);
                if (GamePad.GetState(PlayerIndex.Two).IsConnected) pressed = pressed || IsPressed(button, held, PlayerIndex.Two);
                if (GamePad.GetState(PlayerIndex.Three).IsConnected) pressed = pressed || IsPressed(button, held, PlayerIndex.Three);
                if (GamePad.GetState(PlayerIndex.Four).IsConnected) pressed = pressed || IsPressed(button, held, PlayerIndex.Four);
                if(pressed) _mControllerIndexSet = true;
            }
            else pressed = pressed || IsPressed(button, held, ControllerIndex);
            return pressed;
        }

Same methods

ControllerControl::IsPressed ( Buttons button, bool held, PlayerIndex playerIndex ) : bool