// Update is called once per frame
 void Update()
 {
     if (queuedUnits > 0)
     {
         foreach (BarracksScript Barrack in UnitBarracks)
         {
             if (!Barrack.IsTraining)
             {
                 if (Barrack.CreateUnit())
                 {
                     queuedUnits--;
                     if (queuedUnits <= 0)
                     {
                         break;
                     }
                 }
             }
         }
     }
 }