FullEmptyStatTrigger
A class in Root.Township, Alta.StatSystem.
Fires events when a stat on a StatManager hits its maximum or its minimum. Server events run on the server only, effect events on non headless builds.
- Listed in Stats, effects, heat and liquid
- Inherits or implements
MonoBehaviour - Derived types
SerializedFullEmptyStatTrigger - Documented in Stats
Constructors
| Member | What it is |
|---|---|
FullEmptyStatTrigger() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
protected bool wasFull | Whether the stat was last full, so each event fires once per swing. |
6 private and internal fields
| Member | What it is |
|---|---|
private UnityEvent onEmpty | Server event when the stat empties. |
private TransformEvent onEmptyEffect | Effect event (given this transform) when the stat empties. Not on headless builds. |
private UnityEvent onFull | Server event when the stat fills. |
private TransformEvent onFullEffect | Effect event (given this transform) when the stat fills. Not on headless builds. |
private StatManager targetManager | The stat manager to watch. |
private StatDefinition targetStat | The stat to watch. |
Methods
2 private and internal methods
| Member | What it is |
|---|---|
private void OnStatChanged(Stat trackedStat) | Fires the empty events when the value reaches the minimum after being full, and the full events when it reaches the maximum. |
private void Start() | Sets the starting state from whether the value is past half, and watches the stat. |