Пример #1
0
        public static IAsyncResult Once(long millisecond, Action action)
        {
            var timer = new CoroutineTimerExecutor();

            timer.Start();
            return(timer.Delay(action, millisecond));
        }
Пример #2
0
 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);
 }
Пример #3
0
 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);
 }
Пример #4
0
 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);
 }