Exemplo n.º 1
0
    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);
    }