StatUpgradeTarget
A class in Root.Township, Alta.StatSystem.
Networked one use item that permanently raises a player's stat (capped at maxValue), and can top up a related stat. Used up on the server and no longer saved.
- Listed in Stats, effects, heat and liquid
- Inherits or implements
NetworkEntityBehaviour - Derived types
OneTimeUpgradeInteraction - Nested types
StatIncreaseType - Documented in Stats
Constructors
| Member | What it is |
|---|---|
StatUpgradeTarget() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
10 private and internal fields
| Member | What it is |
|---|---|
private StatDefinition baseStat | Second stat changed on upgrade, used when onUpgradeIncrease isn't none. |
private Transform effectOrigin | Where the effect and onUpgraded start. |
private bool isValid | False once used. |
private float maxValue | Cap for the target stat's base. |
private TransformEvent onUpgraded | Event fired with effectOrigin on upgrade. |
private StatUpgradeTarget.StatIncreaseType onUpgradeIncrease | What happens to baseStat: nothing, add the same amount, or fill to maximum. |
private PooledObjectDefinition statEffect | Pooled StatUpgradeEffect played on clients. |
private MethodSyncStruct<uint> syncPlayer | Network sync that sends the upgraded player's entity id. |
private StatDefinition targetStat | The stat raised. |
private float upgrade | Amount added to the target stat. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Creates the effect sync. |
void UpgradePlayer(IPlayer player) | Server: upgrades the player once, then marks the item to not be saved. |
void UpgradePlayer(PlayerController player) | Server: upgrades the player once, then marks the item to not be saved. |
protected void UpgradePlayerInternal(PlayerController player) | Adds upgrade to the target stat, raises or fills baseStat, then syncs the effect and fires onUpgraded. |