private void StopUpdate(RegularUpdate update) { if (update == null) { return; } update.IsCancelled = true; _taskToRemove.Add(update); }
public void StartUpdate(ref RegularUpdate task, Action <float> update, float period) { if (task != null) { if (task.Update == update) { return; } StopUpdate(ref task); } task = GetOrCreate(); task.Update = update; task.Period = period; task.LastUpdate = Time.time; task.IsOnce = false; task.IsCancelled = false; _tasks.Add(task); }
//public RegularUpdate LateUpdateOnce(Action<float> update) //{ // var task = StartUpdate(update, Time.fixedDeltaTime + Mathf.Epsilon); // task.IsOnce = true; // return task; //} public void StopUpdate(ref RegularUpdate update) { StopUpdate(update); update = null; }