/// <summary> /// Stops all animations that exceeded their frame range and maximum number of cycles in the last frame /// </summary> internal void FinalizeFinishedAnimations() { foreach (KeyValuePair <Guid, HashSet <string> > finishedAnimationsForEntity in FinishedAnimations) { foreach (string animationName in finishedAnimationsForEntity.Value) { StopAnimation(finishedAnimationsForEntity.Key, animationName); } } FinishedAnimations.Clear(); }
/// <summary> /// Computes the next frame for an animation of an entity. Stops the animation or increases cycle if /// frame range of animation is exceeded /// </summary> /// <param name="entityGuid">Guid of the entity for which the animation is computed</param> /// <param name="animation">Animation that is currently playing</param> /// <param name="frameDuration">Duration of the last frame in milliseconds</param> /// <returns>New Keyframe of the animation</returns> internal float PerformTickForEntityAnimation(Guid entityGuid, KeyframeAnimation animation, double frameDuration) { float newKey = 0f; // Perform next keyframe computation and stop animation if number of cycles reached the end if (!animation.Tick(frameDuration, out newKey)) { if (!FinishedAnimations.ContainsKey(entityGuid)) { FinishedAnimations.Add(entityGuid, new HashSet <string>()); } FinishedAnimations[entityGuid].Add(animation.Name); } return(newKey); }