/// <summary> /// Updates every tweens with a delta time ang handles the tween life-cycles /// automatically. /// </summary> /// <remarks> /// Updates every tweens with a delta time ang handles the tween life-cycles /// automatically. If a tween is finished, it will be removed from the /// manager. The delta time represents the elapsed time between now and the /// last update call. Each tween or timeline manages its local time, and adds /// this delta to its local time to update itself. /// <p/> /// Slow motion, fast motion and backward play can be easily achieved by /// tweaking this delta time. Multiply it by -1 to play the animation /// backward, or by 0.5 to play it twice slower than its normal speed. /// </remarks> public virtual void Update(float delta) { for (int i = objects.Count - 1; i >= 0; i--) { IBaseTween obj = objects[i]; if (obj.IsFinished() && obj.isAutoRemoveEnabled) { objects.RemoveAt(i); obj.Free(); } } if (!isPaused) { if (delta >= 0) { for (int i = 0, n = objects.Count; i < n; i++) { objects[i].Update(delta); } } else { for (int i = objects.Count - 1; i >= 0; i--) { objects[i].Update(delta); } } } }
public override void Free() { for (int i = children.Count - 1; i >= 0; i--) { IBaseTween obj = children[i]; children.RemoveAt(i); obj.Free(); } pool.Free(this); }