A class in Root.Township, the global namespace.
Profession skill asset that changes one of the player's stats while unlocked: multiplies, adds to or sets its max, base value or min. Reapplied whenever the player gets a new body.
Constructors
| Member | What it is |
|---|
StatBonusSkill() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private Dictionary<Player, float> defaultValues | Per player, the stat value from before a Set operation, restored on lock. |
private StatBonusSkill.OperationTarget operationTarget | Which part of the stat changes: max, base value or min. |
private StatBonusSkill.OperationType operationType | How value is applied: multiply, add or set. |
private StatDefinition targetStat | The stat to change. |
private float value | The amount used by the operation. |
Methods
| Member | What it is |
|---|
override void Lock(PlayerProgressionManager player) | Stops listening for new player controllers and undoes the change on the current one. |
override void Unlock(PlayerProgressionManager player) | Applies the bonus now and again each time the player's controller is set. |
3 private and internal methods
| Member | What it is |
|---|
private void PrepareGetSet(PlayerController playerController, out Func<float> get, out Action<float> set) | Builds getter and setter functions for the chosen part (max, base or min) of the target stat. |
private void RemoveValue(PlayerController playerController) | Undoes the change: divides, subtracts, or restores the value saved before a set. |
private void SetValue(Player player, PlayerController playerController) | On the next frame, applies the operation to the stat on the given player controller. |