public void Update() { if (currentAction == null) { if (actions.Count == 0) { ezes -= Update; ezes_global -= Update; return; } currentAction = actions.Dequeue(); } var delta = Time.deltaTime; if (timer < currentAction.duration) { timer += delta; currentAction.action(timer / currentAction.duration); return; } currentAction.action(1); timer -= currentAction.duration; if (isLooped) { actions.Enqueue(currentAction); } currentAction = null; }
public EZQueue Wait(Func <bool> a) { Add(float.MaxValue, t => { if (!a()) { return; } timer = 0; currentAction = null; }).Wait(0.3f); return(this); }