27 lines
524 B
C#
27 lines
524 B
C#
using Engine.Util;
|
|
|
|
namespace DoomDeathmatch.Script.Condition;
|
|
|
|
public class TickableTimerCondition : ICondition
|
|
{
|
|
public event Action? OnTrue;
|
|
public bool IsTrue => _timer.IsFinished;
|
|
|
|
private readonly TickableTimer _timer;
|
|
|
|
public TickableTimerCondition(float parInterval)
|
|
{
|
|
_timer = new TickableTimer(parInterval);
|
|
_timer.OnFinished += () => OnTrue?.Invoke();
|
|
}
|
|
|
|
public void Update(double parDeltaTime)
|
|
{
|
|
_timer.Update(parDeltaTime);
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
_timer.Reset();
|
|
}
|
|
} |