#region usings
using System;
using SM.Base.Contexts;
#endregion
namespace SM.Base.Time
{
///
/// Performs intervals.
///
public class Interval : Timer
{
private bool _stop;
///
public Interval(float seconds) : base(seconds)
{
}
///
public Interval(TimeSpan timeSpan) : base(timeSpan)
{
}
///
protected override void Stopping(UpdateContext context)
{
TriggerEndAction(context);
if (_stop)
base.Stop();
else Reset();
}
///
/// This will tell the interval to stop after the next iteration.
/// To stop immediately use
///
public override void Stop()
{
_stop = true;
}
///
/// This will stop the interval immediately.
///
public void Cancel()
{
base.Stop();
}
}
}