public void PopulateZombies() { int maxZombies; int num2; Vector3 vector = new Vector3(0f, 0f, 0f); this.zombieCount = zombieList.Count; this.zomPopRanThisFrame = false; this.zomPopTicksSinceLastUpdate++; if (this.zomPopRanThisFrame || (this.zomPopTicksSinceLastUpdate < this.zomPopTicksBetweenUpdates)) { return; } else { maxZombies = Population.maxZombies; if (IsCityZone(Game.Player.Character.Position)) { maxZombies = Population.maxZombies * 2; } num2 = 0; } while (true) { while (true) { if (num2 < maxZombies) { int num3 = RandoMath.CachedRandom.Next(1, 0x65); bool flag4 = num3 <= 40; vector = !flag4?World.GetNextPositionOnSidewalk(Game.Player.Character.Position.Around((float)maxSpawnDistance)) : World.GetNextPositionOnStreet(Game.Player.Character.Position.Around((float)maxSpawnDistance), true); Vector3 vector2 = vector.Around(5f); if (!((vector2.IsOnScreen() || (Extensions.DistanceTo(Game.Player.Character, vector) < minSpawnDistance)) || IsSafeZone(vector2))) { try { this.ZombieSpawn(vector); this.zomPopTicksSinceLastUpdate = 0 - RandoMath.CachedRandom.Next(this.zomPopTicksBetweenUpdates / 3); this.zomPopRanThisFrame = true; } catch (Exception exception1) { Debug.Log(exception1.ToString()); } } } else { return; } break; } num2++; } }
public void PopulateVehicles() { int maxVehicles; int num2; Vector3 nextPositionOnStreet = new Vector3(0f, 0f, 0f); Vehicle[] allVehicles = World.GetAllVehicles(); this.vehicleCount = allVehicles.Length; this.vehPopRanThisFrame = false; this.vehPopTicksSinceLastUpdate++; if (this.vehPopRanThisFrame || (this.vehPopTicksSinceLastUpdate < this.vehPopTicksBetweenUpdates)) { return; } else { maxVehicles = Population.maxVehicles; if (IsCityZone(Game.Player.Character.Position)) { maxVehicles = Population.maxVehicles * 2; } num2 = 0; } while (true) { while (true) { if (num2 < maxVehicles) { Vector3 position = Game.Player.Character.Position; nextPositionOnStreet = World.GetNextPositionOnStreet(position.Around((float)maxSpawnDistance), true); Vector3 vector2 = nextPositionOnStreet.Around(5f); if (!((vector2.IsOnScreen() || (Extensions.DistanceTo(Game.Player.Character, nextPositionOnStreet) < minSpawnDistance)) || IsSafeZone(vector2))) { try { this.VehicleSpawn(nextPositionOnStreet, RandoMath.RandomHeading()); this.vehPopTicksSinceLastUpdate = 0 - RandoMath.CachedRandom.Next(this.vehPopTicksBetweenUpdates / 3); this.vehPopRanThisFrame = true; } catch (Exception exception1) { Debug.Log(exception1.ToString()); } } } else { return; } break; } num2++; } }
public void PopulateAnimals() { int maxAnimals; int num2; Vector3 vector = new Vector3(0f, 0f, 0f); this.animalCount = animalList.Count; this.aniPopRanThisFrame = false; this.aniPopTicksSinceLastUpdate++; if (this.aniPopRanThisFrame || (this.aniPopTicksSinceLastUpdate < this.aniPopTicksBetweenUpdates)) { return; } else { maxAnimals = Population.maxAnimals; if (IsCityZone(Game.Player.Character.Position)) { maxAnimals = Population.maxAnimals * 2; } num2 = 0; } while (true) { while (true) { if (num2 < maxAnimals) { int num3 = RandoMath.CachedRandom.Next(1, 0x65); bool flag4 = num3 <= 40; vector = !flag4?World.GetNextPositionOnSidewalk(Game.Player.Character.Position.Around((float)maxSpawnDistance)) : World.GetNextPositionOnStreet(Game.Player.Character.Position.Around((float)maxSpawnDistance), true); Vector3 vector2 = vector.Around(5f); if (!((vector2.IsOnScreen() || (Extensions.DistanceTo(Game.Player.Character, vector) < minSpawnDistance)) || IsSafeZone(vector2))) { try { if (this.animalCount < maxAnimals) { Model model; if (IsCityZone(vector)) { model = new Model(RandoMath.GetRandomElementFromList <string>(CityAnimalModels)); } else { model = new Model(RandoMath.GetRandomElementFromList <string>(CountryAnimalModels)); } Ped item = World.CreatePed(model, vector); item.RelationshipGroup = Relationships.AnimalGroup; item.Task.WanderAround(); animalList.Add(item); this.aniPopTicksSinceLastUpdate = 0 - RandoMath.CachedRandom.Next(this.aniPopTicksBetweenUpdates / 3); this.aniPopRanThisFrame = true; } } catch (Exception exception1) { Debug.Log(exception1.ToString()); } } } else { return; } break; } num2++; } }