public void Update(double elapsed)
{
// if a timer is stopped manually, it may not
// be valid at this point so we skip i
if (!valid)
return;
// update the timer's time
time += (float)elapsed;
// if the timer passed its tick length...
if (time >= tickLength)
{
// perform the action
tick(this);
// subtract the tick length in case we need to repeat
time -= tickLength;
// if the timer doesn't repeat, it is no longer valid
valid = repeats;
if (!valid)
{
tick = null;
Tag = null;
}
}
}