An abstract class in Root.Township, Alta.Intelligence.
Base AI hook that grabs a stat on the creature or its target when its action starts, and lets subclasses change it at the start and end. FixedStatChangeHook and ProgressStatChangeHook build on it.
Constructors
| Member | What it is |
|---|
protected StatChangeHook() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|
protected Dictionary<IAgent, Stat> affectedStats | The stat being changed, per running creature. Entries are only removed when the action ends. |
2 private and internal fields
| Member | What it is |
|---|
private bool isTarget | Change the stat on the creature's target instead of the creature. |
private StatDefinition targetStat | Which stat to change. |
Methods
| Member | What it is |
|---|
protected abstract void AffectOnEnd(IActiveAction finished) | Subclass: change the stat when the action finishes or is cancelled. |
protected abstract void AffectOnStart(IActiveAction active) | Subclass: change the stat when the action starts. |
protected override void FinishedOrCancelled(IActiveAction finished) | Calls AffectOnEnd and forgets the creature's stat, if one was found at the start. |
protected override void Used(IActiveAction active) | When the action starts, finds targetStat on the creature (or its target), stores it and calls AffectOnStart. |