public FrameTimer(int frames) { linkHandler = new DisposableLinkHandler(false); ServiceCache.EventBus.Subscribe <T>(linkHandler, () => { if (updateCondition != null) { if (!updateCondition()) { return; } } var completed = elapsed > duration; elapsed += 1; if (!completed && elapsed >= duration) { if (onCompleted != null) { onCompleted(); } } }); this.duration = frames; }
public Timer(float seconds) { linkHandler = new DisposableLinkHandler(false); ServiceCache.EventBus.Subscribe <T>(linkHandler, e => { if (updateCondition != null) { if (!updateCondition()) { return; } } var completed = elapsed > duration; elapsed += Span.Seconds(e.DeltaTime); if (!completed && elapsed >= duration) { if (onCompleted != null) { onCompleted(); } } }); this.duration = Span.Seconds(seconds); }
public Clock() { linkHandler = new DisposableLinkHandler(false); ServiceCache.EventBus.Subscribe <T>(linkHandler, e => { if (updateCondition != null) { if (!updateCondition()) { return; } } elapsed += Span.Seconds(e.DeltaTime); }); }
public FrameClock() { linkHandler = new DisposableLinkHandler(false); ServiceCache.EventBus.Subscribe <T>(linkHandler, () => { if (updateCondition != null) { if (!updateCondition()) { return; } } elapsed += 1; }); }