using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML.Graphics;
using SFML.Window;
using YourBeatingHeart.Main.Graphics;

namespace YourBeatingHeart.Main.States.Play.Entities
{
    public abstract class AnimatedItem : Item
    {
        protected AnimatedSprite Sprite { get { return (AnimatedSprite)Drawable; } set { Drawable = value; } }

        public AnimatedItem(PlayState playState, Vector2f position, String animXML, float width, float height, ItemType type)
            : base(playState, position, new AnimatedSprite(animXML, playState.Game), width, height, type)
        {
        }

        public override bool Set(float x, float y)
        {
            var result = base.Set(x, y);
            Sprite.Position = Position;
            return result;
        }

        public override void Update(float elapsedTime)
        {
            Sprite.Update(elapsedTime);
            base.Update(elapsedTime);
        }

        public override void Draw(RenderTarget renderTarget)
        {
            Sprite.Position = Position;
            base.Draw(renderTarget);
        }
    }
}
