private void OnUnitCreation(Unit unit) { int creditsLeft = battleLogicController.NotifyNewUnitAndReturnCreditsLeft(unit); switch (unit.type) { case UnitType.FOOTMAN: footmanButton.NotifyUnitCreated(); break; case UnitType.HEALER: healerButton.NotifyUnitCreated(); break; case UnitType.ARCHER: archerButton.NotifyUnitCreated(); break; } if (creditsLeft == 0) { unitCreator.DisableCreation(); } }