int InitPopulation(POPULATION population, Citizen.ECONOMIC_CLASS wealth) { for (int x = 0; x < 32; x++) { for (int y = 0; y < 32; y++) { cityHomesGrid[x, y] = -1; // The houses are not ocupied by any citizen nonAllocatedHomes.Add(new Coords(x, y)); } } // Creating the Citizens for (int i = 0; i < populationLimitValues[(int)population]; i++) { string name = "Ciudadano " + i + " de " + CityPlace; Citizen.ECONOMIC_CLASS economicClass = wealth; if (Global.Methods.GetRandomPercentage(0, 100) < 0.25f) { economicClass = (Citizen.ECONOMIC_CLASS)Global.Methods.GetRandom(Enum.GetNames(typeof(Citizen.ECONOMIC_CLASS)).Length); } Index.STATE healthState = Index.STATE.MEDIUM, happinessState = Index.STATE.MEDIUM; CityPart.PLACE livingPlace = CityPlace; Citizen newCitizen = Citizen.CitizenFromAproximation(name, economicClass, healthState, happinessState, livingPlace, city); if (!InstallNewCitizen(newCitizen)) { return(0); } } return(1024 - Citizens.Count); }
//////////////////// // Public Methods // //////////////////// public int CountClassCitizens(Citizen.ECONOMIC_CLASS economicClass) { switch (economicClass) { case Citizen.ECONOMIC_CLASS.LOW: return(lowClassCitizens); case Citizen.ECONOMIC_CLASS.MIDDLE: return(middleClassCitizens); case Citizen.ECONOMIC_CLASS.HIGH: return(highClassCitizens); default: return(-1); } }
////////////////// // Constructors // ////////////////// public CityPart(PLACE cityPlace, POPULATION population, Citizen.ECONOMIC_CLASS populationWealth, INDUSTRY industry, SECTOR_INVESTMENT industryInvestment, FUN fun, SECTOR_INVESTMENT leisureInvestment, INFRASTRUCTURE infrastructure, SECTOR_INVESTMENT transportInvestment, City city) { this.city = city; CityPlace = cityPlace; Citizens = new Dictionary <int, Citizen>(); nonAllocatedHomes = new List <Coords>(); cityHomesGrid = new int[32, 32]; GlobalHappiness = new RepresentativeIndex("Felicidad Global", "Felicidad Global en el barrio " + CityPlace, 0.5f); GlobalHealth = new RepresentativeIndex("Salud Global", "Salud Global en el barrio " + CityPlace, 0.5f); LowClassProportion = new RepresentativeIndex("Clase Baja", "Proporción de ciudadanos de clase baja en el barrio " + CityPlace, 0.5f); MiddleClassProportion = new RepresentativeIndex("Clase Media", "Proporción de ciudadanos de clase media en el barrio " + CityPlace, 0.5f); HighClassProportion = new RepresentativeIndex("Clase Alta", "Proporción de ciudadanos de clase alta en el barrio " + CityPlace, 0.5f); InitLaboralSector(industry, industryInvestment); InitTransportSector(infrastructure, transportInvestment); InitLeisureSector(fun, leisureInvestment); InitPopulation(population, populationWealth); // It has to be the last initialization //ProcessDay(); }
public static Index.STATE GetCitizensEconomicClassProportionState(CityPart.PLACE cityPlace, Citizen.ECONOMIC_CLASS ec) { switch (ec) { case Citizen.ECONOMIC_CLASS.LOW: return(City.CityParts[(int)cityPlace].LowClassProportion.GetIndexState()); case Citizen.ECONOMIC_CLASS.MIDDLE: return(City.CityParts[(int)cityPlace].MiddleClassProportion.GetIndexState());; case Citizen.ECONOMIC_CLASS.HIGH: default: return(City.CityParts[(int)cityPlace].HighClassProportion.GetIndexState());; } }
public static int GetCitizensEconomicClassCount(CityPart.PLACE cityPlace, Citizen.ECONOMIC_CLASS ec) => City.CityParts[(int)cityPlace].CountClassCitizens(ec);