Beispiel #1
0
        void Update()
        {
            lock (lockObj)
            {
                //执行事件队列
                while (eventQueue.Count > 0)
                {
                    Action e = eventQueue.Dequeue();
                    e();
                }
            }

            for (int i = 0; i < prepareUpdateList.Count; i++)
            {
                BaseMonoBehaviour temp = prepareUpdateList[i];
                if (temp.IsNeedUpdate)
                {
                    updateList.Add(temp);
                }
                else
                {
                    updateList.Remove(temp);
                }
            }
            prepareUpdateList.Clear();

            for (int i = 0; i < updateList.Count; i++)
            {
                updateList[i].OnUpdate(Time.deltaTime);
            }
        }
Beispiel #2
0
 public static void PrepareForLateUpdate(BaseMonoBehaviour mono)
 {
     if (Instance != null)
     {
         if (Instance.prepareLateUpdateList.Contains(mono) == false)
         {
             Instance.prepareLateUpdateList.Add(mono);
         }
     }
 }
Beispiel #3
0
        void FixedUpdate()
        {
            for (int i = 0; i < prepareFixedUpdateList.Count; i++)
            {
                BaseMonoBehaviour temp = prepareFixedUpdateList[i];
                if (temp.IsNeedFixedUpdate)
                {
                    fixedUpdateList.Add(temp);
                }
                else
                {
                    fixedUpdateList.Remove(temp);
                }
            }
            prepareFixedUpdateList.Clear();

            for (int i = 0; i < fixedUpdateList.Count; i++)
            {
                fixedUpdateList[i].OnFixedUpdate(Time.deltaTime);
            }
        }