using UnityEngine;

public class RepeatTimer : Timer
{
	private float interval;

	public RepeatTimer(float time, OnEndDelegate onEndEvent)
		: base(time, onEndEvent)
	{
		interval = time;
	}

	public override void Update()
	{
		if (!base.IsEnd)
		{
			RemainTimeSec -= Time.deltaTime;
			if (!(RemainTimeSec > 0f))
			{
				base.IsEnd = true;
				OnFinish();
			}
		}
	}

	private void OnFinish()
	{
		CallEvent();
		RemainTimeSec = interval;
		base.IsEnd = false;
	}
}
