Skip to main content

IncrementingStat

A class in Root.Township, Alta.StatSystem.

Stat definition that changes by a fixed amount per second on the manager's incremental tick, while its value is above 0.

Constructors​

MemberWhat it is
IncrementingStat()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

3 private and internal fields
MemberWhat it is
private bool isIncrementingBacking field for IsIncrementing.
private float statChangePerSecondChange per second. Negative values drain the stat.
private float statChangePerTickstatChangePerSecond times the manager's incremental tick time.

Properties​

MemberWhat it is
bool IsIncrementing { get; }True when the change per second is negative, so the name reads backwards.

Methods​

MemberWhat it is
override void Applied(StatManager manager, Stat stat)Works out the per tick change and adds it on each incremental update while the value is above 0.