/// <summary> /// Attempts to load the specified animation cue. /// </summary> /// <param name="animCue">The T2DAnimationCue to try to load.</param> /// <returns>True if the load was successful.</returns> public bool LoadAnimationCue(T2DAnimationCue animCue) { // make sure the restore info isn't bunk if (!_ValidateAnimationCue(animCue)) return false; // accept the values from the restore info AnimationData = animCue.AnimationData; CurrentTime = animCue.RestoreTime; // tell the animation controller we're not finished! _ac.AnimationFinished = false; // make sure the animation is updated so we start at the right time and get the // right texture coordinates next render for whatever frame the animation's on // (note that _InterpretAnimationData is explicitly called here before // UpdateAnimation) _InterpretAnimationData(); _ac.UpdateAnimation(); // success return true; }
protected bool _ValidateAnimationCue(T2DAnimationCue animCue) { // make sure we got an actual animation cue if (animCue == null) return false; // make sure that the animation data isn't null and has frames if (animCue.AnimationData == null && animCue.AnimationData.AnimationFramesList.Count > 0) return false; // make sure the restore time is valid if (animCue.RestoreTime >= animCue.AnimationData.AnimationDuration || animCue.RestoreTime < 0.0f) return false; // success: return true... return true; }
/// <summary> /// Adds an animation cue to the animation queue to be played after all animations are finished. /// </summary> /// <param name="animCue">The animation cue to add to the animation queue.</param> public void EnqueueAnimation(T2DAnimationCue animCue) { // add the animation cue to the end of the list _animationQueue.Add(animCue); }