Events
Working with stat events.
Last updated
Working with stat events.
Last updated
Each Unit Stats Provider has its own events that you can use to make something happen when a stat is changed. Each event accepts an UpgradableStat parameter.
Property | Description |
---|---|
Let's say you have a stat called HP. If you want something to happen when the HP reaches 0, you can use the onStatReachedMin
event.
In this example, we're calling a custom function called Death
that handles player death when the HP stat reaches 0.
onStatChanged
Called whenever a stat's current value is changed.
onStatReachedMin
Called whenever a stat's current value reaches its min value.
onStatReachedMax
Called whenever a stat's current value reaches its max value.
onStatLevelChanged
Called whenever a stat's level is changed.