using Otter;

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

        public BatteryCell(float x, float y)
        {
            X = x; Y = y;
            SetHitbox(58, 20, (int)Global.Type.POWERCELL);
            _spriteMap = new Spritemap<string>(Assets.POWERCELL, 58, 20);
            _spriteMap.Add("0", new int[] { 58 }, new float[] { 1f, 1f });
            _spriteMap.Add("1", new int[] { 0 }, new float[] { 1f, 1f });
            _spriteMap.Add("2", new int[] { 1 }, new float[] { 1f, 1f });
            _spriteMap.Add("3", new int[] { 2 }, new float[] { 1f, 1f });
            _spriteMap.Add("4", new int[] { 3 }, new float[] { 1f, 1f });
            _spriteMap.Add("5", new int[] { 4 }, new float[] { 1f, 1f });
            _spriteMap.Add("6", new int[] { 5 }, new float[] { 1f, 1f });
            _spriteMap.Add("7", new int[] { 6 }, new float[] { 1f, 1f });
            _spriteMap.Add("8", new int[] { 7 }, new float[] { 1f, 1f });
            _spriteMap.Add("9", new int[] { 8 }, new float[] { 1f, 1f });
            _spriteMap.Add("10", new int[] { 9 }, new float[] { 1f, 1f });
            _spriteMap.Add("11", new int[] { 10 }, new float[] { 1f, 1f });
            _spriteMap.Add("12", new int[] { 11 }, new float[] { 1f, 1f });
            _spriteMap.Add("13", new int[] { 12 }, new float[] { 1f, 1f });
            _spriteMap.Add("14", new int[] { 13 }, new float[] { 1f, 1f });
            _spriteMap.Add("15", new int[] { 14 }, new float[] { 1f, 1f });
            _spriteMap.Add("16", new int[] { 15 }, new float[] { 1f, 1f });
            _spriteMap.Add("17", new int[] { 16 }, new float[] { 1f, 1f });
            _spriteMap.Add("18", new int[] { 17 }, new float[] { 1f, 1f });
            _spriteMap.Add("19", new int[] { 18 }, new float[] { 1f, 1f });
            _spriteMap.Add("20", new int[] { 19 }, new float[] { 1f, 1f });
            _spriteMap.Add("21", new int[] { 20 }, new float[] { 1f, 1f });
            _spriteMap.Add("22", new int[] { 21 }, new float[] { 1f, 1f });
            _spriteMap.Add("23", new int[] { 22 }, new float[] { 1f, 1f });
            _spriteMap.Add("24", new int[] { 23 }, new float[] { 1f, 1f });
            _spriteMap.Add("25", new int[] { 24 }, new float[] { 1f, 1f });
            _spriteMap.Add("26", new int[] { 25 }, new float[] { 1f, 1f });
            _spriteMap.Add("27", new int[] { 26 }, new float[] { 1f, 1f });
            _spriteMap.Add("28", new int[] { 27 }, new float[] { 1f, 1f });
            _spriteMap.Add("29", new int[] { 28 }, new float[] { 1f, 1f });
            _spriteMap.Add("30", new int[] { 29 }, new float[] { 1f, 1f });
            _spriteMap.Add("31", new int[] { 30 }, new float[] { 1f, 1f });
            _spriteMap.Add("32", new int[] { 31 }, new float[] { 1f, 1f });
            _spriteMap.Add("33", new int[] { 32 }, new float[] { 1f, 1f });
            _spriteMap.Add("34", new int[] { 33 }, new float[] { 1f, 1f });
            _spriteMap.Add("35", new int[] { 34 }, new float[] { 1f, 1f });
            _spriteMap.Add("36", new int[] { 35 }, new float[] { 1f, 1f });
            _spriteMap.Add("37", new int[] { 36 }, new float[] { 1f, 1f });
            _spriteMap.Add("38", new int[] { 37 }, new float[] { 1f, 1f });
            _spriteMap.Add("39", new int[] { 38 }, new float[] { 1f, 1f });
            _spriteMap.Add("40", new int[] { 39 }, new float[] { 1f, 1f });
            _spriteMap.Add("41", new int[] { 40 }, new float[] { 1f, 1f });
            _spriteMap.Add("42", new int[] { 41 }, new float[] { 1f, 1f });
            _spriteMap.Add("43", new int[] { 42 }, new float[] { 1f, 1f });
            _spriteMap.Add("44", new int[] { 43 }, new float[] { 1f, 1f });
            _spriteMap.Add("45", new int[] { 44 }, new float[] { 1f, 1f });
            _spriteMap.Add("46", new int[] { 45 }, new float[] { 1f, 1f });
            _spriteMap.Add("47", new int[] { 46 }, new float[] { 1f, 1f });
            _spriteMap.Add("48", new int[] { 47 }, new float[] { 1f, 1f });
            _spriteMap.Add("49", new int[] { 48 }, new float[] { 1f, 1f });
            _spriteMap.Add("50", new int[] { 49 }, new float[] { 1f, 1f });
            _spriteMap.Add("51", new int[] { 50 }, new float[] { 1f, 1f });
            _spriteMap.Add("52", new int[] { 51 }, new float[] { 1f, 1f });
            _spriteMap.Add("53", new int[] { 52 }, new float[] { 1f, 1f });
            _spriteMap.Add("54", new int[] { 53 }, new float[] { 1f, 1f });
            _spriteMap.Add("55", new int[] { 54 }, new float[] { 1f, 1f });
            _spriteMap.Add("56", new int[] { 55 }, new float[] { 1f, 1f });
            _spriteMap.Add("57", new int[] { 56 }, new float[] { 1f, 1f });
            _spriteMap.Add("58", new int[] { 57 }, new float[] { 1f, 1f });
            _spriteMap.Play("0");
            Graphic = _spriteMap;
        }

        public override void Update()
        {
            base.Update();
            if (_spriteMap.CurrentAnim != Global.batteryDivisor.ToString())
                _spriteMap.Play(Global.batteryDivisor.ToString());
        }

        public void Destroy()
        {
            RemoveSelf();
        }
    }
}

