public void Stop(int index) { GameTimerItem item = hashIds[index]; item.enable = false; item.delete = true; }
public int CreateGameTimer(float interval_, bool isLoop_, D_Void_VOid cb_, bool autoStart_ = false) { GameTimerItem item = new GameTimerItem(++staticIndex, interval_, isLoop_, cb_); addItems.Add(item); hashIds.Add(item.index, item); if (autoStart_) { item.enable = true; } return(item.index); }
public void UpdateGameTimer() { if (pause) { return; } for (int i = 0; i < addItems.Count; i++) { items.AddLast(addItems[i]); } addItems.Clear(); LinkedListNode <GameTimerItem> cur, next = items.First; while (next != null) { cur = next; next = cur.Next; GameTimerItem item = cur.Value; if (item.delete) { items.Remove(cur); continue; } if (!item.enable) { continue; } if (item.Check(Time.deltaTime)) { item.Invoke(); if (!item.isLoop) { items.Remove(cur); } } } }
public void Pause(int index) { GameTimerItem item = hashIds[index]; item.enable = false; }
public void StartGameTimer(int index) { GameTimerItem item = hashIds[index]; item.enable = true; }