C# Класс PrinceGame.InputAction

Defines an action that is designated by some set of buttons and/or keys. The way actions work is that you define a set of buttons and keys that trigger the action. You can then evaluate the action against an InputState which will test to see if any of the buttons or keys are pressed by a player. You can also set a flag that indicates if the action only occurs once when the buttons/keys are first pressed or whether the action should occur each frame. Using this InputAction class means that you can configure new actions based on keys and buttons without having to directly modify the InputState type. This means more customization by your games without having to change the core classes of Game State Management.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Evaluate ( InputState state, System controllingPlayer, PlayerIndex &player ) : bool

Evaluates the action against a given InputState.

InputAction ( Buttons buttons, Keys keys, bool newPressOnly ) : System

Initializes a new InputAction.

Описание методов

Evaluate() публичный Метод

Evaluates the action against a given InputState.
public Evaluate ( InputState state, System controllingPlayer, PlayerIndex &player ) : bool
state InputState The InputState to test for the action.
controllingPlayer System The player to test, or null to allow any player.
player PlayerIndex If controllingPlayer is null, this is the player that performed the action.
Результат bool

InputAction() публичный Метод

Initializes a new InputAction.
public InputAction ( Buttons buttons, Keys keys, bool newPressOnly ) : System
buttons Buttons An array of buttons that can trigger the action.
keys Keys An array of keys that can trigger the action.
newPressOnly bool Whether the action only occurs on the first press of one of the buttons/keys, /// false if it occurs each frame one of the buttons/keys is down.
Результат System