LogicValueSender<TData>
An abstract class in Root.Township, Alta.Logic.
Base for logic components (switches, wires and similar) whose value lives in a shared logic data record held by a GlobalLogicManager, so linked parts see the same value. Server-side; saved through the record.
- Listed in Items, inventory and logic
- Inherits or implements
LogicValueSender,ISavable<TData>,ISavableSave<TData>,ISavableSaveBase - Derived types
LogicBoolSender,LogicFloatSender,LogicIntSender,LogicVector3Sender
Constructors
| Member | What it is |
|---|---|
protected LogicValueSender() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
2 private and internal fields
Properties
Methods
| Member | What it is |
|---|---|
override void Clear() | Drops the link to the data record. |
override void EditorPreSave(GlobalLogicManager manager) | Editor hook before saving. Empty here. |
override void InitializeAsServer(SpawnData spawnData) | Server: finds the logic manager (parent or global) and reads the current value if data exists. |
protected virtual void OnValidate() | Editor: links prefab instances to a data record, or clears the id on prefab assets. |
protected abstract void ReadDataValue() | Subclass: applies the record's value to the component. Also called when the record changes from elsewhere. |
protected void UpdateDataValue() | Writes the component's value into the record and notifies listeners. |
protected abstract void WriteDataValue() | Subclass: copies the component's value into the record. |
2 private and internal methods
| Member | What it is |
|---|---|
private void SetupData() | Hooks ReadDataValue to the data's ChangedExternally event and Unsubscribe to the entity's scene destroy. Called on load. |
private void Unsubscribe(NetworkEntity entity, bool isUnload) | Removes the ChangedExternally listener when the entity is destroyed by the scene. |