Beispiel #1
0
 private void SpawnPeds()
 {
     _peds = _peds.Where(Exists).ToList();
     if (_peds.Count < _maxZombies)
     {
         for (int i = 0; i < _maxZombies - _peds.Count; i++)
         {
             Vector3 position = PlayerPed.Position;
             Vector3 spawn    = position.Around((float)_spawnDistance);
             spawn = World.GetNextPositionOnStreet(spawn);
             if (!IsValidSpawn(spawn))
             {
                 break;
             }
             Vector3 around = spawn.Around(5f);
             if (around.IsOnScreen() || around.VDist(PlayerPosition) < (float)_minSpawnDistance)
             {
                 break;
             }
             Ped ped = World.CreateRandomPed(around);
             if (!(ped == null))
             {
                 _peds.Add(ZombieCreator.InfectPed(ped, _zombieHealth, false));
             }
         }
     }
 }
Beispiel #2
0
 private void OnTick(object sender, EventArgs e)
 {
     if (Spawn)
     {
         if (!MenuConrtoller.MenuPool.IsAnyMenuOpen())
         {
             if (ZombieCreator.IsNightFall() && !_nightFall)
             {
                 UiExtended.DisplayHelpTextThisFrame("Nightfall approaches. Zombies are far more ~r~aggressive~s~ at night.", false);
                 _nightFall = true;
             }
             else if (!ZombieCreator.IsNightFall())
             {
                 _nightFall = false;
             }
         }
         SpawnVehicles();
         SpawnPeds();
     }
     else
     {
         ClearAll();
     }
 }