Skip to main content

MultiDeltaInputController

A class in Root.Township, the global namespace.

Combines several IDeltaControl inputs (such as cranks) into one delta, clamped per second and passed on once per frame. Server only by default.

Constructors​

MemberWhat it is
MultiDeltaInputController()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private Object[] controlsInput controls to combine; each must implement IDeltaControl.
private FloatUnityEvent deltaProvidedUnity event raised with the combined delta.
private bool isServerOnlyIf true, only the server listens to the controls.
private float lastTimeTime of the last forwarded input.
private float maxTotalMost the combined delta can be per second.
private float minTotalLeast the combined delta can be per second.
private float totalDelta summed so far this frame.
private IUnityUpdateMethod updateFixed update handle while input is coming in.

Events​

MemberWhat it is
event Action<float> DeltaProvidedEvent raised with the combined delta.

Methods​

MemberWhat it is
override void Initialize()Subscribes to every control's delta event, unless server-only and not on the server.
4 private and internal methods
MemberWhat it is
private void Forward()Clamps the total for this frame, fires both events and resets it.
private void ForwardCheck()Fixed update that forwards any total left from the last frame and stops after a second with no input.
private void HandleDelta(float delta)Adds an input delta to the total, forwarding the previous frame's total first.
private void OnDestroy()Stops the update.