Esempio n. 1
0
        private void CreateAnimal(ushort buildingID, ref Building data)
        {
            SimulationManager instance1       = Singleton <SimulationManager> .instance;
            CitizenManager    instance2       = Singleton <CitizenManager> .instance;
            CitizenInfo       groupAnimalInfo = instance2.GetGroupAnimalInfo(ref instance1.m_randomizer, this.m_info.m_class.m_service, this.m_info.m_class.m_subService);
            //begin mod
            var animalIndex = WildlifeSpawnManager.instance.SpawnMap.ContainsKey(buildingID) ? WildlifeSpawnManager.instance.SpawnMap[buildingID] : 0;

            animalIndex--;
            groupAnimalInfo = WildlifeSpawnManager.instance.GetGroupAnimalInfo(ref instance1.m_randomizer, this.m_info.m_class.m_service, this.m_info.m_class.m_subService, animalIndex);
            //end mod
            ushort instance3;

            if (groupAnimalInfo == null || !instance2.CreateCitizenInstance(out instance3, ref instance1.m_randomizer, groupAnimalInfo, 0U))
            {
                return;
            }
            //begin mod
            PetAIDetour.isCaged = true;
            //end mod
            groupAnimalInfo.m_citizenAI.SetSource(instance3, ref instance2.m_instances.m_buffer[(int)instance3], buildingID);
            groupAnimalInfo.m_citizenAI.SetTarget(instance3, ref instance2.m_instances.m_buffer[(int)instance3], buildingID);
            //begin mod
            PetAIDetour.isCaged = false;
            //end mod
        }
Esempio n. 2
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);
                    }
                }
            }
        }
        private void CreateAnimal(ushort buildingID, ref Building data)
        {
            CitizenManager instance1       = Singleton <CitizenManager> .instance;
            Randomizer     r               = new Randomizer((int)buildingID);
            CitizenInfo    groupAnimalInfo = PrefabCollection <CitizenInfo> .FindLoaded("Dog");//instance1.GetGroupAnimalInfo(ref r, ItemClass.Service.Residential, ItemClass.SubService.ResidentialLow);

            ushort instance2;

            if (groupAnimalInfo == null || !instance1.CreateCitizenInstance(out instance2, ref Singleton <SimulationManager> .instance.m_randomizer, groupAnimalInfo, 0U))
            {
                return;
            }
            PetAIDetour.isCaged = true;
            groupAnimalInfo.m_citizenAI.SetSource(instance2, ref instance1.m_instances.m_buffer[(int)instance2], buildingID);
            PetAIDetour.SetTarget((PetAI)groupAnimalInfo.m_citizenAI, instance2, ref instance1.m_instances.m_buffer[(int)instance2], buildingID);
            PetAIDetour.isCaged = false;
        }