Skip to main content

InputSource

An abstract class in Root.Township, the global namespace.

Base for one button-like input on a controller (see ControllerInput). It holds pressed state, notes when it changed, and raises pressed and released events.

Constructors​

MemberWhat it is
protected InputSource()Creates an InputSource with default values.

Fields​

MemberWhat it is
protected bool stateBacking field for State.

Properties​

MemberWhat it is
bool IsChanged { get; private set; }True if the last EventSet changed the state.
bool State { get; set; }True while pressed.

Events​

MemberWhat it is
event InputSourceHandler InputEndedRaised by OnInputEnded.
event InputSourceHandler InputStartedRaised by OnInputStarted.
event ClickedEventHandler PressedRaised when the input is pressed.
event ClickedEventHandler UnpressedRaised when the input is released.

Methods​

MemberWhat it is
void Event(PlayerInput controller)Raises Pressed or Unpressed depending on the current state.
void EventSet(InputSource source)Copies the state from another input and records whether it changed.
void OnInputEnded(PlayerInput controller)Raises InputEnded.
void OnInputStarted(PlayerInput controller)Raises InputStarted.
void OnPressed(PlayerInput controller)Raises Pressed.
void OnUnpressed(PlayerInput controller)Raises Unpressed.
protected virtual void InternalEventSet(InputSource source)Hook for subclasses to copy extra data in EventSet.

Used in​

Members of other types that take, return or hold a InputSource: