private void StartNextTween() { if (this.chainInternal.Count > 0) { this.currentItem = this.chainInternal[this.currentIndex].StartTween(); this.currentIndex++; } }
/// <summary> /// Maintains the current chain but puts us back at the beginning /// </summary> public void Refresh() { this.currentIndex = 0; this.currentItem = null; var chainCopy = new List <IChainItem>(this.chainInternal); foreach (var item in chainCopy) { item.Refresh(); } StartNextTween(); }
public void Update(float dt) { if (this.currentItem == null && this.chainInternal.Count > this.currentIndex) { StartNextTween(); } if (this.currentItem != null) { this.currentItem.Update(dt); if (this.currentItem.IsComplete) { this.currentItem = null; // We recurse to queue up next item, this has a few interesting consequences: // 1) callbacks execute instantly, therefore: // 2) callbacks that queue up additional callbacks with no delay will infinite loop Update(dt); } } }
public TweenChain Append(IChainItem item) { this.chainInternal.Add(item); return(this); }
public void Clear() { this.chainInternal.Clear(); this.currentIndex = 0; this.currentItem = null; }
/// <summary> /// Skip to the end of the tween, skipping everything in between /// </summary> public void SkipToEnd() { this.currentIndex = this.chainInternal.Count; this.currentItem = null; }
public CoR <TContext> AddNext(IChainItem <TContext> chainItem) { Chain.Enqueue(chainItem); return(this); }