Class StatSystem
Handles the stats of a CharacterData. It stores the health and strength/agility/defense stats. This class contains various functions for interacting with stats, by adding stat modifications, elemental effects or damage.
Inheritance
Namespace: CreatorKitCode
Assembly: Assembly-CSharp.dll
Syntax
[Serializable]
public class StatSystem
Fields
baseStats
Declaration
public StatSystem.Stats baseStats
Field Value
Type | Description |
---|---|
StatSystem.Stats |
Properties
CurrentHealth
Declaration
public int CurrentHealth { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ElementalEffects
Declaration
public List<BaseElementalEffect> ElementalEffects { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<BaseElementalEffect> |
stats
Declaration
public StatSystem.Stats stats { get; set; }
Property Value
Type | Description |
---|---|
StatSystem.Stats |
TimedModifierStack
Declaration
public List<StatSystem.TimedStatModifier> TimedModifierStack { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<StatSystem.TimedStatModifier> |
Methods
AddElementalEffect(BaseElementalEffect)
Add an elemental effect to the StatSystem. Elemental Effect does not stack, adding the same type (the Equals return true) will instead replace the old one with the new one.
Declaration
public void AddElementalEffect(BaseElementalEffect effect)
Parameters
Type | Name | Description |
---|---|---|
BaseElementalEffect | effect |
AddModifier(StatSystem.StatModifier)
Add a modifier to the end of the stack. This will recompute the Stats so it now include the new modifier.
Declaration
public void AddModifier(StatSystem.StatModifier modifier)
Parameters
Type | Name | Description |
---|---|---|
StatSystem.StatModifier | modifier |
AddTimedModifier(StatSystem.StatModifier, Single, String, Sprite)
Add a Timed modifier. Timed modifier does not stack and instead re-adding the same type of modifier will just reset the already existing one timer to the given duration. That the use of the id parameter : it need to be shared by all timed effect that are the "same type". i.e. an effect that add strength can use "StrengthTimed" as id, so if 2 object try to add that effect, they won't stack but instead just refresh the timer.
Declaration
public void AddTimedModifier(StatSystem.StatModifier modifier, float duration, string id, Sprite sprite)
Parameters
Type | Name | Description |
---|---|---|
StatSystem.StatModifier | modifier | A StatModifier container the wanted modification |
System.Single | duration | The time during which that modification will be active. |
System.String | id | A name that identify that type of modification. Adding a timed modification with an id that already exist reset the timer instead of adding a new one to the stack |
UnityEngine.Sprite | sprite | The sprite used to display the time modification above the player UI |
ChangeHealth(Int32)
Change the health by the given amount : negative amount damage, positive amount heal. The function will take care of clamping the value in the range [0...MaxHealth]
Declaration
public void ChangeHealth(int amount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | amount |
Damage(Weapon.AttackData)
Will damage (change negatively health) of the amount of damage stored in the attackData. If the damage are negative, this heal instead.
This will also notify the DamageUI so a damage number is displayed.
Declaration
public void Damage(Weapon.AttackData attackData)
Parameters
Type | Name | Description |
---|---|---|
Weapon.AttackData | attackData |
Death()
Declaration
public void Death()
Init(CharacterData)
Declaration
public void Init(CharacterData owner)
Parameters
Type | Name | Description |
---|---|---|
CharacterData | owner |
RemoveModifier(StatSystem.StatModifier)
Remove a modifier from the stack. This modifier need to already be on the stack. e.g. used by the equipment effect that store the modifier they add on equip and remove it when unequipped.
Declaration
public void RemoveModifier(StatSystem.StatModifier modifier)
Parameters
Type | Name | Description |
---|---|---|
StatSystem.StatModifier | modifier |
Tick()
Declaration
public void Tick()