コード例 #1
0
        /// <summary>
        /// startImmediatly가 true이면, delay후에 첫 작업이 시작되고
        /// false라면, delay + interval 시점에 작업이 시작됩니다.
        /// checkCondition이 false면 반복을 종료합니다.
        /// </summary>
        /// <param name="task"></param>
        /// <param name="checkCondition"></param>
        /// <param name="endTask"></param>
        /// <param name="delay"></param>
        /// <param name="interval"></param>
        /// <param name="startImmediatly"></param>
        public IntervalTask(Action task, Func <bool> checkCondition, Action endTask, float delay, float interval,
                            bool startImmediatly = true) : base(task, delay)
        {
            Interval       = interval;
            CheckCondition = checkCondition ?? (() => true);
            EndTask        = endTask;

            var entryReserveTime = startImmediatly
                ? GlobalDispatchTimer.NormalizeTime(delay)
                : GlobalDispatchTimer.NormalizeTime(interval);

            ExecutedTicks = entryReserveTime;
        }
コード例 #2
0
 private void SetInterval()
 {
     ExecutedTicks = GlobalDispatchTimer.NormalizeTime(Interval);
 }