Skip to main content

MaxStatDefinition

A class in Root.Township, Alta.StatSystem.

A stat definition whose value sets the maximum of other stats (its control definitions). Changes are batched and applied at the end of the frame.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private StatDefinition[] controlDefinitionsStats whose maximum this stat drives.
private static Dictionary<Stat, StatManager> endOfFrameBufferStatic queue of changed stats and their managers, waiting to be applied.

Methods​

MemberWhat it is
override void Applied(StatManager manager, Stat stat)If the manager has any control stat, binds this stat so changes queue an update, and hooks the manager's reset.
4 private and internal methods
MemberWhat it is
private bool IsValidForManager(StatManager manager)True if the manager has at least one of the control stats.
private void OnReset(StatManager manager)On a stat manager reset, sets each control stat's maximum and base to this stat's base.
private static void ProcessChangeBuffer()Applies every queued change, then clears the buffer. Runs one frame after the first change.
private static void UpdateManager(Stat stat, StatManager manager)Sets the maximum of each control stat in a manager to this stat's base.

Used in​

Members of other types that take, return or hold a MaxStatDefinition: