コード例 #1
0
            public void GetAJob(uint citizenIndex)
            {
                CitizenManager citizenManager = Singleton <CitizenManager> .instance;

                if (citizenManager.m_citizens.m_buffer[citizenIndex].m_workBuilding == 0 && citizenManager.m_citizens.m_buffer[citizenIndex].m_homeBuilding != 0)
                {
                    SimulationManager simulationManager = Singleton <SimulationManager> .instance;
                    BuildingManager   buildingManager   = Singleton <BuildingManager> .instance;
                    TransferManager   transferManager   = Singleton <TransferManager> .instance;
                    Vector3           position          = buildingManager.m_buildings.m_buffer[citizenManager.m_citizens.m_buffer[citizenIndex].m_homeBuilding].m_position;

                    TransferManager.TransferOffer offer = default(TransferManager.TransferOffer);
                    offer.Priority = simulationManager.m_randomizer.Int32(8);
                    offer.Citizen  = citizenIndex;
                    offer.Position = position;
                    offer.Amount   = 1;
                    offer.Active   = true;
                    switch (citizenManager.m_citizens.m_buffer[citizenIndex].EducationLevel)
                    {
                    case Citizen.Education.Uneducated:
                        transferManager.AddOutgoingOffer(TransferManager.TransferReason.Worker0, offer);
                        break;

                    case Citizen.Education.OneSchool:
                        transferManager.AddOutgoingOffer(TransferManager.TransferReason.Worker1, offer);
                        break;

                    case Citizen.Education.TwoSchools:
                        transferManager.AddOutgoingOffer(TransferManager.TransferReason.Worker2, offer);
                        break;

                    case Citizen.Education.ThreeSchools:
                        transferManager.AddOutgoingOffer(TransferManager.TransferReason.Worker3, offer);
                        break;
                    }
                }
            }