Skip to main content

TimedStatModifier

A class in Root.Township, Alta.StatSystem.

A stat modifier that removes itself after a duration, using the Timeline. Can be sent over the network and saved.

Constructors​

MemberWhat it is
TimedStatModifier(StatModifier modifier)Creates a TimedStatModifier from modifier and duration.
TimedStatModifier(StatModifier modifier, float duration)Creates a TimedStatModifier from modifier and duration.

Fields​

MemberWhat it is
Action<TimedStatModifier> OnRemovedCalled when Remove runs. Not called when a loaded or received modifier expires, since those call the modifier's own remove.
1 private and internal field
MemberWhat it is
private Timeline.IEntry entryTimeline entry that removes the modifier when its time runs out. Saved and synced so the timer carries over.

Properties​

MemberWhat it is
StatModifier Modifier { get; private set; }The stat modifier being timed.

Methods​

MemberWhat it is
void Cancel()Cancels the timed removal. The modifier stays applied.
static TimedStatModifier Load(StatManagerSaveData.TimedModifier data)Rebuilds a timed modifier from save data. Returns null if its time has already run out.
void Remove()Removes the modifier from its stat and calls OnRemoved.
StatManagerSaveData.TimedModifier Save()Returns save data with the stat, value, multiplier flag and remaining time.
static TimedStatModifier Serialize(TimedStatModifier baseValue, Stream stream)Reads or writes a timed modifier on a network stream. Returns null when read with no time left.

Used in​

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