General Workflow

Input Components Standard is developed to support adaptive control. It means that the Standard supports different input devices (namely keyboard, gamepad, mouse and touch screen). The Standard also supports dynamic configuration of control of external system of control settings. General workflow of standard looks as follows:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/9b663c40-380c-4e8c-a63a-4dcf772f7173/Untitled.png

Control layout consists of arbitrary amount of control elements. First, control element calculates the states of every InputComponentController, then they are assembled into InputHubController, then, if necessary, common value is being adjusted by InputPostprocessController component and finally it goes to the external character control component.

Input Component Controller

InputComponentController class is the basis for all components of hardware input. Standard includes the minimum set of hardware input components, which could be conveniently classified into two groups: mechanical and touchscreen. Derivation tree looks as follows:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a5803b0c-d47f-4496-a736-49ccee86e2d6/Untitled.png

Descendants of InputComponentController class is responsible for bindings to buttons/ axis of the input device and the adjustment of different input parameters (e.g. sensitivity, inversion etc.). For example, MechanicalDirection2DController component, adjusted to recieve the input from gamepad, looks as follows:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/34e4bdf2-da05-4377-92bd-c049a6af38cf/Untitled.png

Input Hub Controller

InputHubController component is aggregator of all InputComponentController components for control element. As can be seen in general scheme, InputHubController supports up to four hardware control variations (i.e. keyboard, gamepad, mouse and touch screen). Depending on which InputComponentController component is active, InputHubController gets corresponding input data and defines input mode. If several InputComponentController components happen to be active, InputHubController chooses top-priority one, according to the determined order:

  1. Touchscreen;
  2. Gamepad;
  3. Mouse;
  4. Keyboard.

Apart from four references to input components of different devices, InputHubController also has property-enumeration inputMode, the value of which indicates the current active input device, as well as OnInputModeChanged event that is being triggered at the moment of switching the active input device. In Editor, InputHubController looks as follows: