/// <summary> /// Advances the animated WorldEntity through its animation cycle based on the environment time elapsed, per the stored animation frames. /// </summary> /// <param name="Operand">The WorldEntity being animated by this operation.</param> public void Step(WorldEntity Operand) { if (!pTrigger) { return; } cSpent = true; if (pMove) { Operand.Move(GetVector(MovementFrames)); } if (pRotate) { Operand.Rotate(GetRadians(RotationFrames)); } if (pScale) { Operand.Scale(GetVector(ScaleFrames)); } if (pColour) { Operand.Colour(GetColour(ColourFrames)); } if (pFrames) { Point ACo = GetFrame(FrameFrames); if (ACo != new Point(-1, -1)) { Operand.SetAtlasFrame(ACo); } } if (cSpent) { if (!Loop) { pSpent = true; if (AnimationRegInternal.Contains(this)) { AnimationRegInternal.Remove(this); } } else { pStarted = false; MovementFrames = (SortedList)lastMovementFrames.Clone(); RotationFrames = (SortedList)lastRotationFrames.Clone(); ScaleFrames = (SortedList)lastScaleFrames.Clone(); ColourFrames = (SortedList)lastColourFrames.Clone(); } } }
/// <summary> /// Jumps an animated WorldEntity to the end of this Animation's cycle. /// </summary> /// <param name="Operand">The WorldEntity being animated by this operation.</param> public void Jump(WorldEntity Operand) { if (!pTrigger) { return; } int MaxTime = 0; foreach (int T in lastMovementFrames.Keys) { if (T > MaxTime) { MaxTime = T; } } foreach (int T in lastScaleFrames.Keys) { if (T > MaxTime) { MaxTime = T; } } foreach (int T in lastRotationFrames.Keys) { if (T > MaxTime) { MaxTime = T; } } foreach (int T in lastColourFrames.Keys) { if (T > MaxTime) { MaxTime = T; } } foreach (int T in FrameFrames.Keys) { if (T > MaxTime) { MaxTime = T; } } MaxTime++; if (pMove) { Operand.Move(GetVector(MovementFrames, MaxTime)); } if (pRotate) { Operand.Rotate(GetRadians(RotationFrames, MaxTime)); } if (pScale) { Operand.Scale(GetVector(ScaleFrames, MaxTime)); } if (pColour) { Operand.Colour(GetColour(ColourFrames, MaxTime)); } if (pFrames) { Point ACo = GetFrame(FrameFrames); if (ACo != new Point(-1, -1)) { Operand.SetAtlasFrame(ACo); } } if (!Loop) { pSpent = true; if (AnimationRegInternal.Contains(this)) { AnimationRegInternal.Remove(this); } } else { pStarted = false; MovementFrames = (SortedList)lastMovementFrames.Clone(); RotationFrames = (SortedList)lastRotationFrames.Clone(); ScaleFrames = (SortedList)lastScaleFrames.Clone(); ColourFrames = (SortedList)lastColourFrames.Clone(); } StartTime = Environment.TickCount; }