public AnimatedSpriteComponent(bool myMain, Vector2 myPosition, Texture2DFramed myTex)
            : base(myMain)
        {
            this.name = "AnimatedSpriteComponent";
            this.position = myPosition;

            this.texture = myTex.texture;
            frameWidth = myTex.frameWidth;
            frameHeight = myTex.frameHeight;

            numberFrames = this.texture.Width / frameWidth -1;
            interval = myTex.animationSpeed;
            animating = true;
        }
        public UnitSpriteComponent(bool isMain, Vector2 position, Texture2DFramed tex)
            : base(isMain, position, tex)
        {
            this.name = "UnitSpriteComponent";
            /*
            this.isMainSprite = isMain;
            this.position = position;
            this.texture = tex.texture;

            frameWidth = tex.frameWidth;
            frameHeight = tex.frameHeight;

            numberFrames = this.texture.Width / frameWidth -1;
            interval = tex.animationSpeed;
            animating = true;*/

            //this = new AnimatedSpriteComponent(isMain, position, texture);
        }
        public void CreateUnit(Vector2 myCoordinate, Texture2DFramed myFramedTexture, UnitData myUnitData)
        {
            HexComponent hexComp = GetHex(myCoordinate);

            if (hexComp.GetUnit() == null)
            {
                SpriteComponent hexSprite = GetHex(myCoordinate)._parent.GetDrawable("SpriteComponent") as SpriteComponent;

                Entity unitEntity = new Entity(15, State.ScreenState.SKIRMISH);

                AnimatedSpriteComponent unitSprite = new AnimatedSpriteComponent(true, hexSprite.GetCenterPosition(), myFramedTexture);

                unitEntity.AddComponent(unitSprite);

                UnitComponent unitComp = new UnitComponent(GetHex(myCoordinate), true);
                unitComp.SetUnitData(myUnitData);
                unitEntity.AddComponent(unitComp);

                EntityManager.AddEntity(unitEntity);

                alliedUnitList.Add(unitEntity);
                totalUnitList.Add(unitEntity);

                hexComp.SetUnit(unitComp);
                UpdateVisibilityAllies();
            }
            else
            {
                throw new Exception("There is already a unit where you are trying to create one.");
            }
        }