public override void Update(GameTime gameTime) { List <FlxTimer> loopedTimers = null; float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; foreach (FlxTimer timer in _timers) { if (timer.Active && !timer.Finished && timer.Time >= 0) { int timerLoops = timer.ElapsedLoops; timer.Update(elapsed); if (timerLoops != timer.ElapsedLoops) { if (loopedTimers == null) { loopedTimers = new List <FlxTimer>(); } loopedTimers.Add(timer); } } } if (loopedTimers != null) { while (loopedTimers.Count > 0) { FlxTimer timer = loopedTimers[0]; loopedTimers.Remove(timer); timer.OnLoopFinished(); } } base.Update(gameTime); }
public void Remove(FlxTimer timer) { _timers.Remove(timer); }
public void Add(FlxTimer timer) { _timers.Add(timer); }