using Otter;

namespace SuperRefluxPowergridDefense_.entities
{
    class PlayerDeath : Entity
    {
        private Spritemap<string> _spriteMap;

        public PlayerDeath(float x, float y)
        {
            X = x; Y = y;
            _spriteMap = new Spritemap<string>(Assets.PLAYERDEATH, 100, 100);
            _spriteMap.Add("death", new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, new float[] { 5f, 5f });
            _spriteMap.Play("death");
            _spriteMap.CenterOrigin();
            Graphic = _spriteMap;
            Layer = -1;
            SoundManager.PlayRequestedSound("_deathForEverything");
        }

        public override void Update()
        {
            base.Update();
            if (_spriteMap.CurrentAnim == "death" && _spriteMap.CurrentFrameIndex == 16)//zerobased.
            {
                Destroy();
                //Global.GAME.RemoveScene();
                //Global.GAME.AddScene(new RedLoseScreen());
            }
        }
        public void Destroy()
        {
            RemoveSelf();
        }
    }
}
