using Otter;

namespace GiraffeRoller.entities
{
    class STree : Entity
    {
        private Spritemap<string> _spriteMap;

        public STree(float x, float y, Color color, float scale, int layer)
        {
            X = x; Y = y;
            _spriteMap = new Spritemap<string>(Assets.STREE, 100, 100);
            _spriteMap.Add("0", new int[] { 0, 1, 0, 2 }, new float[] { Rand.Float(15f,22f), Rand.Float(15f, 22f) });
            var rand = Rand.Int(0, 6);//one less than max should work
            //System.Console.WriteLine("rand: {0}", rand);
            _spriteMap.Play("0");
            if (color != Color.White)
                _spriteMap.Color = Color.Lerp(Color.White, Color.Orange, Rand.Float(.1f, .7f));
            else
                _spriteMap.Color = color;
            _spriteMap.Scale = scale;
            var va = Rand.Int(1, 2);
            if (va <= 1)
                _spriteMap.FlippedX = true;
            Graphic = _spriteMap;
            //System.Console.WriteLine("layer: {0}", layer);
            if (layer <= 0)
                Layer = -1;
            else
                Layer = 3;
        }

        public override void Render()
        {
            base.Render();
            //Collider.Render();
            //RemoveSelf();
        }
    }
}