using System;
namespace Core.Utilities
{
///
/// A Timer that repeats until it is stopped - the callback is fired at the end of every repetition
///
public class RepeatingTimer : Timer
{
///
/// Constructor
///
/// The time of one cycle
/// The event fired at the end of each cycle
public RepeatingTimer(float time, Action onElapsed = null)
: base(time, onElapsed)
{
}
///
/// Ticks and does not turn off on elapse
///
/// The change in time since last tick
/// false always to ensure that the timer is not automatically removed
public override bool Tick(float deltaTime)
{
if (AssessTime(deltaTime))
{
Reset();
}
return false;
}
}
}