Beispiel #1
0
    public static Citizen CitizenFromAproximation(string name, ECONOMIC_CLASS economicClass,
                                                  Index.STATE healthState, Index.STATE happinessState, CityPart.PLACE livingPlace, City city)
    {
        int money;

        switch (economicClass)
        {
        case ECONOMIC_CLASS.LOW:
            money = Global.Methods.GetRandom(0, 1500);
            break;

        case ECONOMIC_CLASS.HIGH:
            money = Global.Methods.GetRandom(3500, 10000);
            break;

        case ECONOMIC_CLASS.MIDDLE:
        default:
            money = Global.Methods.GetRandom(1500, 3500);
            break;
        }
        float   healthValue    = Index.GetRoughValueFromState(healthState);
        float   happinessValue = Index.GetRoughValueFromState(happinessState);
        Citizen res            = new Citizen(name, money, healthValue, happinessValue, livingPlace, ENVIROMENTAL_COMMITMENT.NONE, city);

        return(res);
    }
Beispiel #2
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);
    }
Beispiel #3
0
    public static Citizen RandomCitizen(string name, City city)
    {
        ECONOMIC_CLASS economicClass = (ECONOMIC_CLASS)Global.Methods.GetRandom(Enum.GetNames(typeof(ECONOMIC_CLASS)).Length);

        Index.STATE    healthState   = (Index.STATE)Global.Methods.GetRandom(Enum.GetNames(typeof(Index.STATE)).Length);
        Index.STATE    happinesState = (Index.STATE)Global.Methods.GetRandom(Enum.GetNames(typeof(Index.STATE)).Length);
        CityPart.PLACE livingPlace   = (CityPart.PLACE)Global.Methods.GetRandom(Enum.GetNames(typeof(CityPart.PLACE)).Length);
        Citizen        res           = CitizenFromAproximation(name, economicClass, healthState, happinesState, livingPlace, city);

        return(res);
    }