/** triggers the timer */ public void update(float dt) { if (FloatUtils.EQ(_elapsed, -1)) { _elapsed = 0; _nTimesExecuted = 0; } else { if (_runForever && !_useDelay) { //standard timer usage _elapsed += dt; if (FloatUtils.EB(_elapsed, _interval)) { trigger(); _elapsed = 0; } } else { //advanced usage _elapsed += dt; if (_useDelay) { if (FloatUtils.EB(_elapsed, _delay)) { trigger(); _elapsed = _elapsed - _delay; _nTimesExecuted += 1; _useDelay = false; } } else { if (FloatUtils.EB(_elapsed, _interval)) { trigger(); _elapsed = 0; _nTimesExecuted += 1; } } if (!_runForever && FloatUtils.Big(_nTimesExecuted, _repeat)) { cancel(); } } } }