43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using UnityEngine;
|
|
|
|
public class TickingRuntimeEffectInstance : RuntimeEffectInstance
|
|
{
|
|
public float timeSinceLastTick = 0f;
|
|
|
|
public virtual void Tick(float deltaTime)
|
|
{
|
|
timeSinceLastTick += deltaTime;
|
|
|
|
if (timeSinceLastTick >= GameConstants.GameBalancing.EffectsTickingRate)
|
|
{
|
|
PerformTick();
|
|
timeSinceLastTick = 0f; // Reset timer after ticking
|
|
}
|
|
}
|
|
|
|
protected virtual void PerformTick()
|
|
{
|
|
// Override in specific effect types (DOT, HealOT, etc.)
|
|
// Example: Apply damage based on numberOfStacks
|
|
}
|
|
|
|
public override void OnEffectFirstApplied(int numberOfStacksApplied)
|
|
{
|
|
base.OnEffectFirstApplied(numberOfStacksApplied);
|
|
timeSinceLastTick = 0f;
|
|
}
|
|
|
|
public override void OnEffectRefreshed(int numberOfStacksAdded)
|
|
{
|
|
base.OnEffectRefreshed(numberOfStacksAdded);
|
|
// Optionally reset tick timer on refresh
|
|
// timeSinceLastTick = 0f;
|
|
}
|
|
|
|
public new void Reset()
|
|
{
|
|
base.Reset();
|
|
timeSinceLastTick = 0f;
|
|
}
|
|
}
|