public void AddConstructedBuilding(Building building) { constructedBuildings.Add(building); BuildingType type = building.GetStats().type; if (type == BuildingType.residential) { residentialBuildings.Add(building.gameObject.GetComponent <ResidentialBuilding>()); } else if (type == BuildingType.industrial) { industrialBuildings.Add(building.gameObject.GetComponent <IndustrialBuilding>()); } else if (type == BuildingType.commercial) { commercialBuildings.Add(building.gameObject.GetComponent <CommercialBuilding>()); } else if (type == BuildingType.infrastructure) { InfrastructureBuilding infrastructureBuilding = building.GetComponent <InfrastructureBuilding>(); AddInfrastructureBuilding(infrastructureBuilding, infrastructureBuilding.InfrastructureType()); } if (building.gameObject.GetComponent <WorkPlace>() != null) { workPlaces.Add(building.gameObject.GetComponent <WorkPlace>()); } }
public ulong GetNewID(InfrastructureBuilding building) //So far, only parks, police stations and schools require IDs and are limited in number. { InfrastructureService type = building.InfrastructureType(); ulong newID = 0; switch (type) { case InfrastructureService.parks: newID = parkIDHandler.AssignNewBuilding(building.gameObject.GetComponent <Park_1>()); break; case InfrastructureService.safety: newID = policeIDHandler.AssignNewBuilding(building.gameObject.GetComponent <PoliceStation_1>()); break; case InfrastructureService.education: newID = schoolIDHandler.AssignNewBuilding(building.gameObject.GetComponent <School_1>()); break; default: break; } return(newID); }