示例#1
0
 public static void Register(object objectItem, float delayTime, Action callback)
 {
     if (!timerList.ContainsKey(objectItem))
     {
         TimerItem timerItem = new TimerItem(TimerManager.time, delayTime, callback);
         timerList.Add(objectItem, timerItem);
     }
 }
示例#2
0
        public static void Run()
        {
            // 设置时间值
            TimerManager.time = Time.time;

            TimerItem[] objectList = new TimerItem[timerList.Values.Count];
            timerList.Values.CopyTo(objectList, 0);

            // 锁定
            foreach (TimerItem timerItem in objectList)
            {
                if (timerItem != null)
                {
                    timerItem.Run(TimerManager.time);
                }
            }
        }