Example #1
0
 /// <summary>
 /// 生命周期跟随一个对象
 /// </summary>
 /// <param name="target"></param>
 /// <param name="ignoreTargetActive">忽略对象激活状态变化</param>
 public TimerTask DoFollow(MonoBehaviour target, FollowTargetMode followMode)
 {
     if (target == null)
     {
         return(this);
     }
     this.target           = target;
     followTargetType      = eFollowTargetType.Target1;
     this.followTargetMode = followMode;
     return(this);
 }
Example #2
0
        /// <summary>
        /// 将当前Timers重置到刚创建出来的状态
        /// </summary>
        public virtual void Clear()
        {
            _fun    = null;
            _runner = null;
            Running = false;
            Stop    = false;
            Paused  = false;

            followTargetType = eFollowTargetType.None;

            target  = null;
            target2 = null;

            followTargetMode = FollowTargetMode.TargetDisactiveDoStop;

            _delayTime = 0;

            _loopDuration = 0;

            _loopCount = 0;

            IgnoreTimeScale = false;

            _savedDelayTime = 0;

            _savedLoopCount = 0;

            _savedLoopDuration = 0;


#if DEBUG_PERFORMANCE_TRACE
            stackInfo = null;
#endif
            if (addedUpdateListener)
            {
                TimerTaskManager.Instance.RemoveUpdateTimer(this);
            }

            addedUpdateListener = false;

            SavedParam1 = null;
            SavedParam2 = null;
            SavedParam3 = null;
            SavedParam4 = null;
        }
Example #3
0
        /// <summary>
        /// 计时器重置到默认创建好的状态,参数保留
        /// </summary>
        /// <returns>The reset.</returns>
        protected TimerTask DoReset(bool autoStart = true)
        {
            Paused  = false;
            Stop    = false;
            Running = false;

            _delayTime       = _savedDelayTime;
            _loopCount       = _savedLoopCount;
            _loopDuration    = _savedLoopDuration;
            this.target      = null;
            this.target2     = null;
            followTargetType = eFollowTargetType.None;
            if (autoStart)
            {
                DoStart();
            }
            return(this);
        }