示例#1
0
文件: CityPart.cs 项目: Phireh/VEUS
    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);
    }
示例#2
0
文件: CityPart.cs 项目: Phireh/VEUS
    //////////////////
    // 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();
    }