LogicValueReceiver<TSenderInput>
An abstract class in Root.Township, Alta.Logic.
Base for a logic component that listens to one logic value sender and reacts when the value changes. Server side; subclasses implement ValueUpdated.
- Listed in Items, inventory and logic
- Inherits or implements
NetworkEntityBehaviour,ILogicValueLinkReceiver,ILogicComponent - Derived types
LogicBoolReceiver,LogicFloatRangeReceiver,LogicFloatReceiver,LogicFloatThresholdReceiver,LogicIntRangeReceiver,LogicIntReceiver,LogicIntThresholdReceiver,LogicVector3Receiver
Constructors
| Member | What it is |
|---|---|
protected LogicValueReceiver() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
protected TSenderInput sender | Backing field for Sender, set in the inspector. |
Properties
| Member | What it is |
|---|---|
GlobalLogicManager LogicManager { get; private set; } | The logic manager this receiver belongs to: one in a parent, or the global one. |
TSenderInput Sender { get; } | The sender input this receiver reads from. |
Methods
| Member | What it is |
|---|---|
void EditorPreSave(GlobalLogicManager manager) | Editor: sets the logic manager and points the sender input at it before saving. |
override void InitializeAsServer(SpawnData spawnData) | Server: subscribes to the sender, finds the logic manager (parent or global) and calls ValueUpdated once. |
protected void LoadContext() | Sets LogicManager to GlobalLogicManager.Current. |
protected virtual void OnDestroy() | Cleans up the sender input subscription. |
protected virtual void OnDrawGizmos() | Draws the link to the sender in the editor. |
protected abstract void ValueUpdated() | Called when the sender's value changes, and once at server start. Implement the reaction here. |
2 private and internal methods
| Member | What it is |
|---|---|
private bool Alta.Logic.ILogicValueLinkReceiver.AttemptLink(LogicValueSender sender) | Explicit ILogicValueLinkReceiver method; passes the sender to Sender.AttemptLink and returns whether it linked. |
private void FindLogicManager() | Sets LogicManager to the nearest GlobalLogicManager in the parents, or the global one, if not already set. Called from InitializeAsServer. |