public ScheduleObj AddSchedule(Action Action, float Delay = 0.0f) { ScheduleObj obj = new ScheduleObj(Action, Delay); scheduleList.Add(obj); return(obj); }
private void Update() { for (int i = 0; i < scheduleList.Count; ++i) { ScheduleObj obj = scheduleList[i]; obj.Update(); if (obj.IsDone) { scheduleList.RemoveAt(i--); } } for (int i = 0; i < threadedScheduleList.Count; ++i) { ThreadedSchedule info = threadedScheduleList[i]; lock (info) { if (!info.IsCompleted) { continue; } } try { info.OnComplete?.Invoke(); threadedScheduleList.RemoveAt(i--); }catch (Exception e) { Debug.LogError(e); } } }