public static IAsyncResult Once(long millisecond, Action action) { var timer = new CoroutineTimerExecutor(); timer.Start(); return(timer.Delay(action, millisecond)); }
public OneTimeDelayTask(CoroutineTimerExecutor executor, Action command, TimeSpan delay) { this._startTime = (long)(Time.fixedTime * TimeSpan.TicksPerSecond); this._delay = delay; this._executor = executor; this._command = command; this._executor.Add(this); }
public FixedRateDelayTask(CoroutineTimerExecutor executor, Action command, TimeSpan initialDelay, TimeSpan period) : base() { this._startTime = (long)(Time.fixedTime * TimeSpan.TicksPerSecond); this._initialDelay = initialDelay; this._period = period; this._executor = executor; this._command = command; this._executor.Add(this); }
public DurationFixedRateTask(CoroutineTimerExecutor executor, Action <long> fixedUpdateCommand, Action endCommand, TimeSpan?initialDelay, TimeSpan?period, TimeSpan?duration) : base() { this._startTime = (long)(Time.fixedTime * TimeSpan.TicksPerSecond); this._initialDelay = initialDelay ?? TimeSpan.Zero; this._period = period ?? TimeSpan.FromMilliseconds(10); this._duration = duration; this._executor = executor; this._fixedUpdateCommand = fixedUpdateCommand; this._endCommand = endCommand; this._executor.Add(this); }