Skip to main content

OperatedValue

A class in Root.Township, the global namespace.

Component holding a float that inspector events can add to, subtract from, multiply, divide or set, firing changed after each change.

Constructors​

MemberWhat it is
OperatedValue()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

1 private and internal field
MemberWhat it is
private FloatEvent changedEvent fired with the new value after every operation.

Properties​

MemberWhat it is
float Value { get; private set; }The current value. Starts at 0 and isn't saved.

Methods​

MemberWhat it is
void Add(float amount)Adds the amount to Value and fires changed.
void Divide(float amount)Meant to divide, but the code subtracts the amount from Value, then fires changed.
void Multiply(float amount)Multiplies Value by the amount and fires changed.
void Set(float value)Sets Value and fires changed.
void Subtract(float amount)Subtracts the amount from Value and fires changed.