/// <summary> /// Creates a new instance /// </summary> /// <param name="texture">The spritesheet texture containing all frames of animation</param> /// <param name="animationDefinition">The <see cref="AnimationDefinition"/> to use</param> public AnimatedSprite(Texture2D texture, AnimationDefinition animationDefinition) : base(texture) { _animationDefinition = animationDefinition; Play(_animationDefinition.Animations.First().Key); CurrentAnimation = _animationDefinition.Animations.First().Value; CurrentFrame = _animationDefinition.Frames[CurrentAnimation.from]; FrameTimer = CurrentFrame.duration; }
/// <summary> /// Creates a new instance /// </summary> /// <param name="texture">The spritesheet texture containing all frames of animation</param> /// <param name="animationDefinition">The <see cref="AnimationDefinition"/> to use</param> /// <param name="position"></param> public AnimatedSprite(Texture2D texture, AnimationDefinition animationDefinition, Vector2 position) : this(texture, animationDefinition) { Position = position; }