Stats Class |
Namespace: Kit.Containers
The Stats type exposes the following members.
| Name | Description | |
|---|---|---|
| Stats | Initializes a new instance of the Stats class | |
| Stats(IUpgradeable) | Initializes a new instance of the Stats class |
| Name | Description | |
|---|---|---|
| Add | Set the base value of a stat. | |
| CalculateValue(ValueTupleSingle, Single, Single, Single) | Calculate current value from a base value and aggregates. | |
| CalculateValue(IUpgradeable, String, Single) | Calculate the current value of an stat based on base value. | |
| CreateCurrentProperty | Create a property that changes values when the base property changes or an upgrade is added or removed. | |
| Dispose | Releases all resources used by the Stats | |
| GetAggregates(IEnumerableEffect) | Calculate aggregates from a list of effects. | |
| GetAggregates(IUpgradeable, String) | Calculate aggregates of an stat. | |
| GetBaseProperty | Get the base value property of a stat. | |
| GetBaseValue | Get the base value of a stat. | |
| GetCurrentProperty | Get the current value property of a stat. | |
| GetCurrentValue | Get the current value of a stat. | |
| GetEffects | Get all effects on an IUpgradeable for a given stat. | |
| GetEffectsAndUpgrades | Get all upgrades and effects on an IUpgradeable for a given stat. | |
| SetBaseProperty | Set the base value property of a stat. | |
| SetBaseValue | Set the base value of a stat. | |
| ToString | Returns all the base and current values as a formatted table. (Overrides ObjectToString.) |
| Name | Description | |
|---|---|---|
| Upgradeable | The IUpgradeable to use for calculating current values. |
public class Player: IUpgradeable { public Stats Stats; public AsyncReactiveList<Upgrade> Upgrades = new AsyncReactiveList<Upgrade>(); public void Initialize() { Stats = new Stats(this); Stats["Health"] = 100.0f; Stats["Damage"] = 15.0f; Upgrade upgrade = new Upgrade("SturdyHelmet"); upgrade.AddEffect("Health", "+50"); upgrade.AddEffect("Damage", "+25%"); Upgrades.Add(upgrade); Debug.Log(Stats.ToString()); } public AsyncReactiveList<Upgrade> GetUpgrades() { return Upgrades; } }