Exemplo n.º 1
0
        public void UpdateMgr()
        {
            TimeItem item = null;

            m_CurrentUnScaleTime = Time.unscaledTime;
            m_CurrentScaleTime   = Time.time;

            #region  受缩放影响定时器更新

            while ((item = m_UnScaleTimeHeap.Top()) != null)
            {
                if (!item.isEnable)
                {
                    m_UnScaleTimeHeap.Pop();
                    item.Recycle2Cache();
                    continue;
                }

                if (item.SortScore < m_CurrentUnScaleTime)
                {
                    m_UnScaleTimeHeap.Pop();

                    item.OnTimeTick();

                    if (item.isEnable && item.NeedRepeat())
                    {
                        Post2Really(item);
                    }
                    else
                    {
                        item.Recycle2Cache();
                    }
                }
                else
                {
                    break;
                }
            }

            #endregion

            #region 受缩放影响定时器更新

            while ((item = m_ScaleTimeHeap.Top()) != null)
            {
                if (!item.isEnable)
                {
                    m_ScaleTimeHeap.Pop();
                    item.Recycle2Cache();
                    continue;
                }

                if (item.SortScore < m_CurrentScaleTime)
                {
                    m_ScaleTimeHeap.Pop();

                    item.OnTimeTick();

                    if (item.isEnable && item.NeedRepeat())
                    {
                        Post2Scale(item);
                    }
                    else
                    {
                        item.Recycle2Cache();
                    }
                }
                else
                {
                    break;
                }
            }

            #endregion
        }
Exemplo n.º 2
0
 public void Post2Scale(TimeItem item)
 {
     item.SortScore = m_CurrentScaleTime + item.DelayTime();
     m_ScaleTimeHeap.Insert(item);
 }
Exemplo n.º 3
0
 public void Post2Really(TimeItem item)
 {
     item.SortScore = m_CurrentUnScaleTime + item.DelayTime();
     m_UnScaleTimeHeap.Insert(item);
 }