36 lines
959 B
C#
36 lines
959 B
C#
using Kryz.CharacterStats;
|
|
using Kryz.CharacterStats.Examples;
|
|
using UnityEngine;
|
|
|
|
[System.Serializable]
|
|
public class MovementSpeedModifierRuntimeEffectInstance : RuntimeEffectInstance
|
|
{
|
|
public float speedModifierPercentage;
|
|
|
|
public CharacterStats targetStats;
|
|
|
|
public override void OnEffectFirstApplied(int numberOfStacksApplied)
|
|
{
|
|
base.OnEffectFirstApplied(numberOfStacksApplied);
|
|
|
|
targetStats = target.GetComponent<CharacterStats>();
|
|
|
|
//TODO: Update this to use a new movementspeedhandler
|
|
targetStats.GetStat("movementspeed").AddModifier(new StatModifier(speedModifierPercentage, StatModType.PercentAdd, sourceEffect));
|
|
}
|
|
|
|
public override void OnEffectRemoved()
|
|
{
|
|
base.OnEffectRemoved();
|
|
|
|
targetStats.GetStat("movementspeed").RemoveAllModifiersFromSource(sourceEffect);
|
|
}
|
|
|
|
|
|
public new void Reset()
|
|
{
|
|
base.Reset();
|
|
speedModifierPercentage = 0f;
|
|
}
|
|
}
|