Class SimStatSource

Namespace
SurvivorsMaker.Simulation
Assembly
SurvivorsMaker.Simulation.dll

External stat inputs are read-only; missing health declares its maximum-health dependency.

public sealed class SimStatSource : IStatDebitSource, IStatSource, IStatSourceDependencies
Inheritance
SimStatSource
Implements
Inherited Members

Constructors

SimStatSource(SimWorld, IStatSource)

public SimStatSource(SimWorld world, IStatSource fallback = null)

Parameters

world SimWorld
fallback IStatSource

Properties

Revision

Revision stamp for reported source values; change it whenever those values change.

public long Revision { get; }

Property Value

long

Methods

GetDependencies(string, List<string>)

Reports stat ids used to derive an external source into the reusable output list; must not mutate gameplay.

public void GetDependencies(string key, List<string> into)

Parameters

key string
into List<string>

TryDebit(string, float)

Atomically spends a nonnegative amount from a source; false must leave its state unchanged.

public bool TryDebit(string key, float amount)

Parameters

key string
amount float

Returns

bool

TryGet(string, out float)

Reads a stable external source value without side effects; false means the key is not supplied.

public bool TryGet(string key, out float value)

Parameters

key string
value float

Returns

bool