// // Private Methods // // // Contracts // /// <summary> /// Implements what the animation will actually perform /// </summary> protected override void Animate() { AnimationUnitMotion currUnit = this.currentUnit as AnimationUnitMotion; // If this asset goes off, you probably forgot to attach animation units Debug.Assert(currUnit != null); this.goTarget.SetPosition(goTarget.X + currUnit.DeltaX, goTarget.Y + currUnit.DeltaY); }
/// <summary> /// Prefills the pool with the given number of elements /// </summary> /// <param name="fillSize"></param> protected override void FillReserve(int fillSize) { for (int i = fillSize; i > 0; i--) { AnimationUnitMotion newNode = new AnimationUnitMotion(); this.reservedList.PushFront(newNode); } }
/// <summary> /// Attaches a delta X-Y pair to the motion animation /// </summary> /// <param name="newDeltaX"></param> /// <param name="newDeltaY"></param> /// <returns></returns> virtual public AnimationUnitMotion Attach(float newDeltaX, float newDeltaY) { AnimationUnitMotion newUnit = this.BaseAttach(0u) as AnimationUnitMotion; newUnit.SetDeltas(newDeltaX, newDeltaY); this.PointToStartingAnimationUnit(); return(newUnit); }
protected override void FillReserve(int fillSize) { // "fillSize" not used. Just allocate space for one unit AnimationUnitMotion newNode = new AnimationUnitMotion(); this.reservedList.PushFront(newNode); base.Attach(0.0f, 0.0f); }
/// <summary> /// Change the X-motion of the animation /// </summary> /// <param name="newXChange"></param> public void AssignNewXChange(float newXChange) { AnimationUnitMotion itr = this.activeList.Head as AnimationUnitMotion; while (itr != null) { itr.SetDeltaX(newXChange); itr = itr.next as AnimationUnitMotion; } }