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 }
public void Post2Scale(TimeItem item) { item.SortScore = m_CurrentScaleTime + item.DelayTime(); m_ScaleTimeHeap.Insert(item); }
public void Post2Really(TimeItem item) { item.SortScore = m_CurrentUnScaleTime + item.DelayTime(); m_UnScaleTimeHeap.Insert(item); }