예제 #1
0
 /// <summary>
 /// 构造定时器
 /// </summary>
 /// <param name="time">定时时长</param>
 /// <param name="flag">定时器标识符</param>
 /// <param name="loop">是否循环</param>
 /// <param name="ignorTimescale">是否忽略TimeScale</param>
 private Timer(float time, string flag, bool loop = false, bool ignorTimescale = true)
 {
     if (null == driver)
     {
         driver = TimerDriver.Get;                 //初始化Time驱动
     }
     _time           = time;
     _loop           = loop;
     _ignorTimescale = ignorTimescale;
     cachedTime      = CurrentTime;
     if (timers.Exists((v) => { return(v._flag == flag); }))
     {
         if (showLog)
         {
             Debug.LogWarningFormat("【TimerTrigger(容错)】:存在相同的标识符【{0}】!", flag);
         }
     }
     _flag = string.IsNullOrEmpty(flag) ? GetHashCode().ToString() : flag;//设置辨识标志符
 }
예제 #2
0
 private void Awake()
 {
     _instance = this;
 }