private void RegisterActiveTimeItem(TimeItem timeItem) { timeItem.id = ++s_NextID; s_TimeItemMap.Add(timeItem.id, timeItem); }
private static void RegisterActiveTimeItem(TimeItem unit) { unit.id = ++s_NextID; s_TimeItemMap.Add(unit.id, unit); }
private void Post2Really(TimeItem item) { item.SortScore = m_CurrentUnScaleTime + item.DelayTime(); m_UnScaleTimeItems.Add(item); }
private void Post2Scale(TimeItem item) { item.SortScore = m_CurrentScaleTime + item.DelayTime(); m_ScaleTimeItems.Add(item); }
private void Post2Scale(TimeItem item) { item.sortScore = m_CurrentScaleTime + item.DelayTime(); m_ScaleTimeHeap.Insert(item); }
public void Update() { 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 }