Beispiel #1
0
        // stock code
        public Citizen.AgeGroup GetAgeGroup(Citizen.AgePhase agePhase)
        {
            switch (agePhase)
            {
            case Citizen.AgePhase.Child:
                return(Citizen.AgeGroup.Child);

            case Citizen.AgePhase.Teen0:
            case Citizen.AgePhase.Teen1:
                return(Citizen.AgeGroup.Teen);

            case Citizen.AgePhase.Young0:
            case Citizen.AgePhase.Young1:
            case Citizen.AgePhase.Young2:
                return(Citizen.AgeGroup.Young);

            case Citizen.AgePhase.Adult0:
            case Citizen.AgePhase.Adult1:
            case Citizen.AgePhase.Adult2:
            case Citizen.AgePhase.Adult3:
                return(Citizen.AgeGroup.Adult);

            case Citizen.AgePhase.Senior0:
            case Citizen.AgePhase.Senior1:
            case Citizen.AgePhase.Senior2:
            case Citizen.AgePhase.Senior3:
                return(Citizen.AgeGroup.Senior);

            default:
                return(Citizen.AgeGroup.Adult);
            }
        }
 private int GetElectricCarProbability(ushort instanceId,
                                       ref CitizenInstance citizenData,
                                       Citizen.AgePhase agePhase)
 {
     Log._DebugOnlyError("CustomResidentAI.GetElectricCarProbability called!");
     return(20);
 }
Beispiel #3
0
        private void CreateFireman(ushort vehicleID, ref Vehicle data, Citizen.AgePhase agePhase)
        {
            SimulationManager instance         = Singleton <SimulationManager> .instance;
            CitizenManager    instance2        = Singleton <CitizenManager> .instance;
            CitizenInfo       groupCitizenInfo = instance2.GetGroupCitizenInfo(ref instance.m_randomizer, this.m_info.m_class.m_service, Citizen.Gender.Male, Citizen.SubCulture.Generic, agePhase);

            if (groupCitizenInfo != null)
            {
                int  family = instance.m_randomizer.Int32(256u);
                uint num    = 0u;
                if (instance2.CreateCitizen(out num, 90, family, ref instance.m_randomizer, groupCitizenInfo.m_gender))
                {
                    ushort num2;
                    if (instance2.CreateCitizenInstance(out num2, ref instance.m_randomizer, groupCitizenInfo, num))
                    {
                        Vector3 randomDoorPosition = data.GetRandomDoorPosition(ref instance.m_randomizer, VehicleInfo.DoorType.Exit);
                        groupCitizenInfo.m_citizenAI.SetCurrentVehicle(num2, ref instance2.m_instances.m_buffer[(int)num2], 0, 0u, randomDoorPosition);
                        groupCitizenInfo.m_citizenAI.SetTarget(num2, ref instance2.m_instances.m_buffer[(int)num2], data.m_targetBuilding);
                        instance2.m_citizens.m_buffer[(int)((UIntPtr)num)].SetVehicle(num, vehicleID, 0u);
                    }
                    else
                    {
                        instance2.ReleaseCitizen(num);
                    }
                }
            }
        }
Beispiel #4
0
        // Copied from ResidentialBuildingAI
        private static int GetResidentRequirement(ImmaterialResourceManager.Resource resource, ref Citizen citizen)
        {
            switch (resource)
            {
            case ImmaterialResourceManager.Resource.HealthCare:
                return(Citizen.GetHealthCareRequirement(Citizen.GetAgePhase(citizen.EducationLevel, citizen.Age)));

            case ImmaterialResourceManager.Resource.DeathCare:
                return(Citizen.GetDeathCareRequirement(Citizen.GetAgePhase(citizen.EducationLevel, citizen.Age)));

            case ImmaterialResourceManager.Resource.PoliceDepartment:
                return(Citizen.GetPoliceDepartmentRequirement(Citizen.GetAgePhase(citizen.EducationLevel, citizen.Age)));

            case ImmaterialResourceManager.Resource.FireDepartment:
                return(Citizen.GetFireDepartmentRequirement(Citizen.GetAgePhase(citizen.EducationLevel, citizen.Age)));

            case ImmaterialResourceManager.Resource.Entertainment:
                return(Citizen.GetEntertainmentRequirement(Citizen.GetAgePhase(citizen.EducationLevel, citizen.Age)));

            case ImmaterialResourceManager.Resource.PublicTransport:
                return(Citizen.GetTransportRequirement(Citizen.GetAgePhase(citizen.EducationLevel, citizen.Age)));

            case ImmaterialResourceManager.Resource.PostService:
                return(Citizen.GetMailAccumulation(citizen.EducationLevel));

            case ImmaterialResourceManager.Resource.EducationElementary:
            {
                Citizen.AgePhase agePhase3 = Citizen.GetAgePhase(citizen.EducationLevel, citizen.Age);
                if (agePhase3 < Citizen.AgePhase.Teen0)
                {
                    return(Citizen.GetEducationRequirement(agePhase3));
                }
                return(0);
            }

            case ImmaterialResourceManager.Resource.EducationHighSchool:
            {
                Citizen.AgePhase agePhase2 = Citizen.GetAgePhase(citizen.EducationLevel, citizen.Age);
                if (agePhase2 >= Citizen.AgePhase.Teen0 && agePhase2 < Citizen.AgePhase.Young0)
                {
                    return(Citizen.GetEducationRequirement(agePhase2));
                }
                return(0);
            }

            case ImmaterialResourceManager.Resource.EducationUniversity:
            {
                Citizen.AgePhase agePhase = Citizen.GetAgePhase(citizen.EducationLevel, citizen.Age);
                if (agePhase >= Citizen.AgePhase.Young0)
                {
                    return(Citizen.GetEducationRequirement(agePhase));
                }
                return(0);
            }

            default:
                return(100);
            }
        }
Beispiel #5
0
        public void GetCitizenIncome(Citizen citizen, int level, ref int income, ref int tourists)
        {
            if ((citizen.m_flags & Citizen.Flags.MovingIn) == Citizen.Flags.None && !citizen.Dead)
            {
                bool tourist = ((citizen.m_flags & Citizen.Flags.Tourist) != Citizen.Flags.None);
                int  age     = citizen.Age;
                Citizen.Education educationLevel = citizen.EducationLevel;
                Citizen.AgePhase  agePhase       = Citizen.GetAgePhase(educationLevel, age);
                int unemployed = citizen.Unemployed;
                var result     = 0;

                if (citizen.Sick && level < 3 && !tourist)
                {
                    result -= 50;
                }
                if (unemployed == 0 || tourist)
                {
                    switch (agePhase)
                    {
                    case Citizen.AgePhase.Child:
                        result += 20;
                        break;

                    case Citizen.AgePhase.Teen0:
                        result += 30;
                        break;

                    case Citizen.AgePhase.Teen1:
                        result += 40;
                        break;

                    case Citizen.AgePhase.Young0:
                        result += 50;
                        break;

                    case Citizen.AgePhase.Young1:
                        result += 60;
                        break;

                    case Citizen.AgePhase.Young2:
                        result += 70;
                        break;

                    case Citizen.AgePhase.Adult0:
                        result += 50;
                        break;

                    case Citizen.AgePhase.Adult1:
                        result += 60;
                        break;

                    case Citizen.AgePhase.Adult2:
                        result += 70;
                        break;

                    case Citizen.AgePhase.Adult3:
                        result += 80;
                        break;

                    case Citizen.AgePhase.Senior0:
                        result += 50;
                        break;

                    case Citizen.AgePhase.Senior1:
                        result += 60;
                        break;

                    case Citizen.AgePhase.Senior2:
                        result += 70;
                        break;

                    case Citizen.AgePhase.Senior3:
                        result += 80;
                        break;
                    }
                }

                if (tourist || level > 2)
                {
                }
                else if (level == 2)
                {
                    result += Math.Max(-10, citizen.m_health + citizen.m_wellbeing - 140);
                }
                else if (level == 1)
                {
                    result += Math.Max(-20, citizen.m_health + citizen.m_wellbeing - 145);
                }
                else
                {
                    result += Math.Max(-44, citizen.m_health + citizen.m_wellbeing - 155);
                }

                if (tourist)
                {
                    tourists += result;
                }
                else
                {
                    income += result;
                }
            }
        }