DoopelPonger
|
Class used to map actions that link to KeyCodes. More...
Public Types | |
enum | Action { Action.PLAYER_0_UP, Action.PLAYER_0_DOWN, Action.PLAYER_0_POWER, Action.PLAYER_0_SHIELD_PRIMARY, Action.PLAYER_0_SHIELD_SECONDARY, Action.PLAYER_1_UP, Action.PLAYER_1_DOWN, Action.PLAYER_1_POWER, Action.PLAYER_1_SHIELD_PRIMARY, Action.PLAYER_1_SHIELD_SECONDARY, Action.MENU_UP_PRIMARY, Action.MENU_UP_SECONDARY, Action.MENU_DOWN_PRIMARY, Action.MENU_DOWN_SECONDARY, Action.MENU_SELECT_PRIMARY, Action.MENU_SELECT_SECONDARY, Action.MENU_BACK_PRIMARY, Action.MENU_BACK_SECONDARY, Action.PAUSE_PRIMARY, Action.PAUSE_SECONDARY } |
Any user input that should make the game perform some action should have a value in this enum. More... | |
Public Member Functions | |
void | Awake () |
Initialize the default KeyCodes by reading in the Controls.json file. More... | |
KeyCode | GetKeyCode (Action action) |
Action | SetKeyCode (Action action, KeyCode keyCode) |
Set the Action to the new KeyCode. More... | |
Class used to map actions that link to KeyCodes.
Class used to check if a KeyCode has been pressed for an associated Action. All types of input checking should implement this class.
Actions are user input that GameObjects need to react to. For example, moving the player, activating power up, navigating through menus, etc. Each of these actions can only be mapped to a single KeyCode but there can be multiple similar actions, for example activate shield primary and activate shield secondary where each individual action can have different KetCodes but link to the same InputManagerListener.
The way input is handled by the InputManager is that the KeyCode state is checked during the Update method, and any callbacks should be triggered in the FixedUpdate method.
|
strong |
Any user input that should make the game perform some action should have a value in this enum.
void InputActionMapper.Awake | ( | ) |
Initialize the default KeyCodes by reading in the Controls.json file.
KeyCode InputActionMapper.GetKeyCode | ( | Action | action | ) |
action | The Action to find the KeyCode for. |
Set the Action to the new KeyCode.
action | Action that should have the corresponding keycode overwritten. |
keyCode | KeyCode to pair with the action. |