public static int SetInterval(int frameInterval, BKAction action) { if (action == null) { return(0); } if (frameInterval <= 0) { action.Invoke(); frameInterval = 1; } while (intervals.ContainsKey(intervalId)) { intervalId++; if (intervalId == int.MaxValue) { intervalId = 1; } } intervals.Add(intervalId, new TickItem(frameInterval, action)); return(intervalId); }
private void DoComplete(bool hasError = false) { this.hasError = hasError; isComplete = true; if (onComplete != null) { onComplete.Invoke(); } }
public void Update() { if (time > 0f) { if (Time.time - last >= time) { action.Invoke(); last = Time.time; } } else { if (last >= frame) { action.Invoke(); last = 0f; } else { last++; } } }