Skip to main content

IndirectModifier

A class in Root.Township, Alta.StatSystem.

A stat modifier whose value follows a curve over a number of ticks, scaled by a base value. The owner calls Update each tick.

Constructors​

MemberWhat it is
IndirectModifier(float baseValue, uint duration, Curve valueOverDuration, uint tick)Creates an IndirectModifier from baseValue, duration and valueOverDuration.
IndirectModifier(float baseValue, uint duration, Curve valueOverDuration)Creates an IndirectModifier from baseValue, duration and valueOverDuration.

Fields​

MemberWhat it is
Action<IndirectModifier> ChangedCalled when the value moves by more than 0.1. Must be set, or Update throws.
Action<IndirectModifier> FinishedCalled on each Update once the duration has passed. Must be set.
4 private and internal fields
MemberWhat it is
private float baseValueValue the curve is multiplied by.
private uint durationLength in ticks; Finished fires on the tick that reaches it.
private uint tickTicks run so far, one per Update. Saved, so the modifier can resume.
private Curve valueOverDurationCurve from progress (0 to 1) to a factor of baseValue. Changed only fires when the value moves by more than 0.1.

Properties​

MemberWhat it is
float LastValue { get; private set; }The value before the latest change. Inside Changed it still holds the old value.
float Value { get; private set; }Current value of the modifier.

Methods​

MemberWhat it is
IndirectModifierSaveData Save()Returns the curve, base value, duration and current tick for saving.
void Update()Advances one tick and updates the value, or calls Finished once the duration is reached.

Used in​

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