public void TrainNewUnit(UnitTrainingInfo info) { if (queuedUnitsToTrain.Count < 4) { queuedUnitsToTrain.Enqueue(info); } }
void Update() { timer += Time.deltaTime; if (queuedUnitsToTrain.Count > 0 && !IsTraining) { IsTraining = true; CurrentTrainingUnit = queuedUnitsToTrain.Dequeue(); timer = 0; } //ToDo: Change this to be less terrible if (timer >= 0 && IsTraining) { ArmyManager.inst.SpawnUnit(ID, CurrentTrainingUnit.unitType, CurrentTrainingUnit.UnitCount); IsTraining = false; } }