NPCStats.AddStatModifier
#
Declarationpublic virtual bool AddStatModifier(GDTKStatModifier modifier, IUniquelyIdentifiable source, StatSource other)
#
ParametersName | Description |
---|---|
modifier | Modifier to add to the object |
source | Object adding this Stat Modifier |
other | Stats associated with the Source, only required if the Source is outside this object and values on that object are referenced by the Stat Modifier. |
#
DescriptionAdds a new Stat Modifier to the object.
#
UsageExample
using NullSave.GDTK.Stats;using UnityEngine;
public class Example : MonoBehaviour{
public void ExampleMethod(NPCStats source) { // Create a modifier that applies 1 time immediately // Modifier changes the value of a Stat with the Id // of 'HP' by adding 2 GDTKStatModifier modifier = new GDTKStatModifier(); modifier.target = ModifierTarget.Value; modifier.applies = ModifierApplication.Immediately; modifier.affectsStatId = "HP"; modifier.changeType = ModifierChangeType.Add; modifier.value.valueExpression = "2";
source.AddStatModifier(modifier); }
}