Eye of the Nile Docs
Everything you need to know to get started!
Loading...
Searching...
No Matches
PlayerStat Class Reference

Detailed Description

Basic properties of a player stat that can be modified by abilities using StatModifiers (see StatModifier, StatsAE, and PlayerStatHolder). Each stat has a name and a base value, set in the editor.

Documentation updated 10/11/2024

Author
Roy Pascaul, Stephen Nuttall
Note
This class does not inhert from monobehavior, so it does not have access to unity functions such as Start() or Update().

Public Member Functions

void AddModifier (StatModifier statMod)
 Add a stat modifier. Checks to see if the stat modifer is already applied.
 
bool RemoveModifier (StatModifier statMod)
 Remove a stat modifier. Checks to see if the stat modifer is actually applied.
 
float FinalValue ()
 Returns the final value of this stat, based on baseValue and all active stat modifiers.
 

Properties

string StatName [get, set]
 Public version of _statName that can be used by scripts.
 
float BaseValue [get, set]
 Public version of _baseValue that can be used by scripts.
 

Events

static Action< string, float > modifierAdded
 Event that is triggered when a stat modifier is added to the player.
 
static Action< string, float > modifierRemoved
 Event that is triggered when a stat modifier is removed from the player.
 

Private Attributes

string _statName
 Name of the stat. Can be changed in the Unity Editor.
 
float _baseValue
 Base value of the stat. Can be changed in the Unity Editor.
 
List< StatModifierstatModifiers = new List<StatModifier>()
 List of currently active stat modifiers.
 

Member Function Documentation

◆ AddModifier()

void PlayerStat.AddModifier ( StatModifier statMod)

Add a stat modifier. Checks to see if the stat modifer is already applied.

Parameters
statModStat modifier to add.

◆ FinalValue()

float PlayerStat.FinalValue ( )

Returns the final value of this stat, based on baseValue and all active stat modifiers.

◆ RemoveModifier()

bool PlayerStat.RemoveModifier ( StatModifier statMod)

Remove a stat modifier. Checks to see if the stat modifer is actually applied.

Parameters
statModStat modifer to remove.
Returns
true if the stat modifier was successfully removed. Otherwise, false.

Member Data Documentation

◆ _baseValue

float PlayerStat._baseValue
private

Base value of the stat. Can be changed in the Unity Editor.

◆ _statName

string PlayerStat._statName
private

Name of the stat. Can be changed in the Unity Editor.

◆ statModifiers

List<StatModifier> PlayerStat.statModifiers = new List<StatModifier>()
private

List of currently active stat modifiers.

Property Documentation

◆ BaseValue

float PlayerStat.BaseValue
getset

Public version of _baseValue that can be used by scripts.

◆ StatName

string PlayerStat.StatName
getset

Public version of _statName that can be used by scripts.

Event Documentation

◆ modifierAdded

Action<string, float> PlayerStat.modifierAdded
static

Event that is triggered when a stat modifier is added to the player.

◆ modifierRemoved

Action<string, float> PlayerStat.modifierRemoved
static

Event that is triggered when a stat modifier is removed from the player.


The documentation for this class was generated from the following file: