/// <summary> /// Set the current animation. /// </summary> /// <param name="animName"></param> public void SetAnimation(string animName) { if (CurrentAnimation != null && CurrentAnimation.Name == animName) { return; } if (!HasAnimation(animName)) { Engine.Log.Warning($"Animation {animName} not found.", MessageSource.Anim); return; } AnimationNode n = Animations[animName]; AnimTex.StartingFrame = n.StartingFrame; AnimTex.EndingFrame = n.EndingFrame; AnimTex.LoopType = n.LoopType; AnimTex.TimeBetweenFrames = n.TimeBetweenFrames; AnimTex.Reset(); CurrentAnimation = n; }
/// <summary> /// Add a new animation. /// </summary> /// <param name="n">The animation node to add.</param> public void AddAnimation(AnimationNode n) { Animations.Add(n.Name, n); }