private void SpawnBuilding(LivingUnitData livingUnitData, Type unitType)
        {
            if (!_typeToRaceUiBuildingManager.ContainsKey(unitType) || _typeToRaceUiBuildingManager[unitType].HasReachedLimit())
            {
                _typeToRaceUiBuildingManager[unitType] = (RaceUiBuildingManager)_buildPlacementManager.AddRaceBuilding(livingUnitData.BuildingSprite);
            }
            else if (_typeToRaceUiBuildingManager.ContainsKey(unitType))
            {
                _typeToRaceUiBuildingManager[unitType].SpawnBuilding();
            }

            _unitDataTypesCount[unitType] = 0;
        }
        private void OnUnitAdded(UnitData unitData)
        {
            LivingUnitData livingUnitData = unitData as LivingUnitData;

            if (livingUnitData != null)
            {
                Type unitType = livingUnitData.GetType();
                if ((IsFirstTimePlacingBuildingForUnitType(unitType) || HasReachedMaxCountForUnitType(unitType)))
                {
                    SpawnBuilding(livingUnitData, unitType);
                }

                CountUnitTypes(unitType);
            }
        }