public void Update() { if (Count != 0) { int count = Count; int i = 0; using (new KProfiler.Region("Scheduler.Update", null)) { float time = clock.GetTime(); if (previousTime != time) { previousTime = time; for (; i < count; i++) { if (!(time >= entries.Peek().Key)) { break; } SchedulerEntry value = entries.Dequeue().Value; if (value.callback != null) { value.callback(value.callbackData); } } } } } }
private bool DoCallback(SchedulerEntry entry) { if (entry.owner == null || entry.owner.Spawned) { try { entry.callback(); return(true); } catch (Exception e) { HugsLibController.Logger.Error("TickDelayScheduler caught an exception while calling {0} registered by {1}: {2}", HugsLibUtility.DescribeDelegate(entry.callback), entry.owner == null ? "[null]" : entry.owner.ToString(), e); } } return(false); }