Skip to main content

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.

Constructors​

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

Fields​

MemberWhat it is
protected bool wasFullWhether the stat was last full, so each event fires once per swing.
6 private and internal fields
MemberWhat it is
private UnityEvent onEmptyServer event when the stat empties.
private TransformEvent onEmptyEffectEffect event (given this transform) when the stat empties. Not on headless builds.
private UnityEvent onFullServer event when the stat fills.
private TransformEvent onFullEffectEffect event (given this transform) when the stat fills. Not on headless builds.
private StatManager targetManagerThe stat manager to watch.
private StatDefinition targetStatThe stat to watch.

Methods​

2 private and internal methods
MemberWhat 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.