Runtime Spawner 1.5.1
Generic Runtime spawn and instance pooling system for spawning random AI agents around a map. Works with ANY AI system easily.
Loading...
Searching...
No Matches
MegaCrush.Spawner.RegionSpawnLoop Class Referencesealed

Periodic loop that manages spawning in active LocalAreaSpawner regions. Ensures each active region maintains its local population between its min/max bounds, while respecting the global max population and per-entry caps. More...

Public Member Functions

 RegionSpawnLoop (RuntimeSpawner owner, ISpawnExecutor exec, PopulationTracker pop)
 
IEnumerator Run (List< LocalAreaSpawner > activeRegions, int maxPopulation)
 Coroutine that runs continuously while RuntimeSpawner.UseRegionSpawners is enabled. For each active region, spawns up to the region’s configured Min/Max (with DensityMult/Override), while respecting the global maxPopulation cap and per-entry maxPopulation.
 

Private Member Functions

void BuildEligibleEntries (List< SpawnEntry > entries)
 Filters a region's entries into _eligibleEntries based on per-entry maxPopulation.
 

Private Attributes

readonly RuntimeSpawner _owner
 
readonly ISpawnExecutor _exec
 
readonly PopulationTracker _pop
 
readonly List< SpawnEntry_eligibleEntries = new(64)
 

Detailed Description

Periodic loop that manages spawning in active LocalAreaSpawner regions. Ensures each active region maintains its local population between its min/max bounds, while respecting the global max population and per-entry caps.

Constructor & Destructor Documentation

◆ RegionSpawnLoop()

MegaCrush.Spawner.RegionSpawnLoop.RegionSpawnLoop ( RuntimeSpawner owner,
ISpawnExecutor exec,
PopulationTracker pop )

Member Function Documentation

◆ BuildEligibleEntries()

void MegaCrush.Spawner.RegionSpawnLoop.BuildEligibleEntries ( List< SpawnEntry > entries)
private

Filters a region's entries into _eligibleEntries based on per-entry maxPopulation.

◆ Run()

IEnumerator MegaCrush.Spawner.RegionSpawnLoop.Run ( List< LocalAreaSpawner > activeRegions,
int maxPopulation )

Coroutine that runs continuously while RuntimeSpawner.UseRegionSpawners is enabled. For each active region, spawns up to the region’s configured Min/Max (with DensityMult/Override), while respecting the global maxPopulation cap and per-entry maxPopulation.

Parameters
activeRegionsList of regions currently active (player inside).
maxPopulationHard cap across all alive spawned objects.

Member Data Documentation

◆ _eligibleEntries

readonly List<SpawnEntry> MegaCrush.Spawner.RegionSpawnLoop._eligibleEntries = new(64)
private

◆ _exec

readonly ISpawnExecutor MegaCrush.Spawner.RegionSpawnLoop._exec
private

◆ _owner

readonly RuntimeSpawner MegaCrush.Spawner.RegionSpawnLoop._owner
private

◆ _pop

readonly PopulationTracker MegaCrush.Spawner.RegionSpawnLoop._pop
private

The documentation for this class was generated from the following file: