// // Virtual Methods // /// <summary> /// Go to the next unit (aka "frame") of the animation /// </summary> /// <remarks> /// Only Null Object should override this method! /// </remarks> virtual protected void ProgressToNextUnit() { // Go to the next animation unit AnimationUnit oldUnit = this.currentUnit; this.currentUnit = this.currentUnit.next as AnimationUnit; // Change the interval time if requested this.intervalTime = this.requestedNewIntervalTime; // If there are still animation units left if (currentUnit != null) { // Reschedule this.ScheduleTimedAnimation(this.intervalTime, this.isLooping); } // Else if there are no more units left else { // Reschedule if this animation loops if (this.isLooping) { this.currentUnit = this.activeList.Head as AnimationUnit; this.ScheduleTimedAnimation(this.intervalTime, true); } else { // Set it back to the previous animation unit this.currentUnit = null; } } }
// // Constructor // public Animation() : base() { this.currentUnit = null; this.currentEvent = null; this.intervalTime = 1.0f; this.requestedNewIntervalTime = this.intervalTime; this.isLooping = false; }
/// <summary> /// Detaches all animation units from the animator. /// Also cancels the current animation from the Timer. /// </summary> virtual public void DetachEverything() { this.CancelTimedAnimation(); AnimationUnit itr = this.activeList.Head as AnimationUnit; while (this.activeList.Head != null) { itr.Reset(); this.activeList.PopFront(); } }
/// <summary> /// Call this method after attaching animation units /// </summary> protected void PointToStartingAnimationUnit() { this.currentUnit = this.activeList.Head as AnimationUnit; }