/// <summary> /// Used to apply a D2SkeletalAnimation to /// the given skeleton. /// </summary> /// <param name="animationName">The name of the /// D2SkeletalAnimation to be played.</param> public void PlayAnimation(string animationName) { for (int i = 0; i < animations.Count; i++) { if (animations[i].Name == animationName) { if (currentAnimation != null) { prevAnimation = currentAnimation; } currentAnimation = animations[i]; currentAnimation.Initialize(); currentAnimation.OnFinished += new HasFinishedEvent(AnimiationFinished); if (prevAnimation != null) { if (blender == null) { blender = new Blender(prevAnimation.BlendingTime, prevAnimation._LimbAnimations, currentAnimation._LimbAnimations); blender.OnFinished += new HasFinishedEvent(FinishedBlending); blending = true; } else { blender.Reset(prevAnimation.BlendingTime, prevAnimation._LimbAnimations, currentAnimation._LimbAnimations); blending = true; } } else { currentAnimation.Play(); } } } }