public void OnTrainBarracks(int unitType) { if (SelectionManager.Instance.PrimarySelectable.type == EntityType.Barracks) { foreach (SelectableObject obj in SelectionManager.Instance.SelectedObjects) { if (obj.type == EntityType.Barracks) { switch (unitType) { case 1: Barracks temp = (Barracks)obj; temp.OnTrainRequest(); break; default: Debug.Log("ERROR UNIT TYPE MISSING"); break; } } } } }