void MakeUnit()
 {
     units++;
     SpriteController spriteController;
     string name;
     switch (producedUnit)
     {
         case 0:
             pickaxes++;
             name = side + "Pickaxe";
             spriteController = new PickaxeController
             {
                 mode = 4,
                 side = unitSide,
                 maxDistance = unitDistance,
                 castle = Entity
             };
             break;
         case 1:
             swords++;
             name = side + "Sword";
             spriteController = new SwordController
             {
                 mode = 4,
                 side = unitSide,
                 maxDistance = unitDistance,
                 castle = (from entities in SceneSystem.SceneInstance where entities.Name == enemy select entities).FirstOrDefault()
             };
             break;
         case 2:
             bowArrows++;
             name = side + "BowArrow";
             spriteController = new BowArrowController
             {
                 mode = 4,
                 side = unitSide,
                 maxDistance = unitDistance
             };
             break;
         case 3:
             wands++;
             name = side + "Wand";
             spriteController = new WandController
             {
                 mode = 4,
                 side = unitSide,
                 maxDistance = unitDistance
             };
             break;
         default:
             name = side + "Unit";
             spriteController = new SpriteController
             {
                 mode = 0,
                 side = unitSide,
                 maxDistance = unitDistance
             };
             break;
     }
     //make entity with specific name and add proper sprite sheet and script to it
     Entity entity;
     if (Entity.Name.Contains("Enemy"))
     {
         entity = new Entity(new Vector3(37, unitPosition, 0), name);
     }
     else
     {
         entity = new Entity(new Vector3(3, unitPosition, 0), name);
     }
     SpriteComponent spriteComponent = new SpriteComponent();
     SpriteSheet spriteSheet = Asset.Get<SpriteSheet>(name.Replace("Enemy", ""));
     spriteComponent.SpriteProvider = new SpriteFromSheet
     {
         Sheet = spriteSheet
     };
     spriteComponent.CurrentFrame = 4 + unitSide;
     ScriptComponent scriptComponent = new ScriptComponent();
     scriptComponent.Scripts.Add(spriteController);
     entity.Add<SpriteComponent>(SpriteComponent.Key, spriteComponent);
     entity.Add<ScriptComponent>(ScriptComponent.Key, scriptComponent);
     SceneSystem.SceneInstance.Scene.AddChild(entity);
 }
        void MakeUnit()
        {
            units++;
            SpriteController spriteController;
            string           name;

            switch (producedUnit)
            {
            case 0:
                pickaxes++;
                name             = side + "Pickaxe";
                spriteController = new PickaxeController
                {
                    mode        = 4,
                    side        = unitSide,
                    maxDistance = unitDistance,
                    castle      = Entity
                };
                break;

            case 1:
                swords++;
                name             = side + "Sword";
                spriteController = new SwordController
                {
                    mode        = 4,
                    side        = unitSide,
                    maxDistance = unitDistance,
                    castle      = (from entities in SceneSystem.SceneInstance where entities.Name == enemy select entities).FirstOrDefault()
                };
                break;

            case 2:
                bowArrows++;
                name             = side + "BowArrow";
                spriteController = new BowArrowController
                {
                    mode        = 4,
                    side        = unitSide,
                    maxDistance = unitDistance
                };
                break;

            case 3:
                wands++;
                name             = side + "Wand";
                spriteController = new WandController
                {
                    mode        = 4,
                    side        = unitSide,
                    maxDistance = unitDistance
                };
                break;

            default:
                name             = side + "Unit";
                spriteController = new SpriteController
                {
                    mode        = 0,
                    side        = unitSide,
                    maxDistance = unitDistance
                };
                break;
            }
            //make entity with specific name and add proper sprite sheet and script to it
            Entity entity;

            if (Entity.Name.Contains("Enemy"))
            {
                entity = new Entity(new Vector3(37, unitPosition, 0), name);
            }
            else
            {
                entity = new Entity(new Vector3(3, unitPosition, 0), name);
            }
            SpriteComponent spriteComponent = new SpriteComponent();
            SpriteSheet     spriteSheet     = Asset.Get <SpriteSheet>(name.Replace("Enemy", ""));

            spriteComponent.SpriteProvider = new SpriteFromSheet
            {
                Sheet = spriteSheet
            };
            spriteComponent.CurrentFrame = 4 + unitSide;
            ScriptComponent scriptComponent = new ScriptComponent();

            scriptComponent.Scripts.Add(spriteController);
            entity.Add <SpriteComponent>(SpriteComponent.Key, spriteComponent);
            entity.Add <ScriptComponent>(ScriptComponent.Key, scriptComponent);
            SceneSystem.SceneInstance.Scene.AddChild(entity);
        }