Skip to main content

SenderInput<TSender, TData>

A class in Root.Township, Alta.Logic.

A logic input that listens to one logic sender's value (for wired logic like levers and doors) and raises ValueUpdated when it changes.

Constructors​

MemberWhat it is
SenderInput()Creates a SenderInput with default values.

Fields​

2 private and internal fields
MemberWhat it is
private TSender aThe sender component set in the inspector. Not read anywhere in this class; linking goes through Load or AttemptLink.
private uint bSerialized uint, probably the sender identifier. Not read anywhere in this class.

Properties​

MemberWhat it is
TData Data { get; private set; }The linked sender's data. Null until linked.

Events​

MemberWhat it is
event Action ValueUpdatedRaised when the linked sender's value changes.

Methods​

MemberWhat it is
override bool AttemptLink(LogicValueSender sender)Links to the sender if it's the right type and in the same logic manager. Returns whether it linked.
override void Destroy()Meant to stop listening to the sender. It removes the wrong handler, so the subscription probably stays.
override void DrawGizmos(Component receiver)Does nothing here.
void Load(GlobalLogicManager manager, TData data)Links to sender data directly, if that data has a logic identifier.
override void Subscribe(Action listener, bool isCalling = true)Adds a listener for value changes and calls it straight away if already linked, unless told not to.
1 private and internal method
MemberWhat it is
private void OnValueUpdated()Forwards the data's UpdatedValue event to this input's ValueUpdated listeners.