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.GlobalSpawnLoop Class Referencesealed

Periodic loop that maintains the Global population between configured bounds. Respects: More...

Public Member Functions

 GlobalSpawnLoop (RuntimeSpawner owner, ISpawnExecutor exec, PopulationTracker pop)
 
IEnumerator Run (List< SpawnEntry > globalSpawners, int minGlobalCount, int maxGlobalCount, int maxOverallPopulation)
 Runs the global spawn loop.
 

Private Member Functions

void BuildEligibleEntries (List< SpawnEntry > globalSpawners)
 Filters entries into _eligibleEntries based on per-entry maxPopulation. Uses SpawnEntry.currentPopulation, which should be maintained by the executor.
 

Private Attributes

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

Detailed Description

Periodic loop that maintains the Global population between configured bounds. Respects:

  • Global loop band (min/maxGlobalObjectCount) for SpawnSource.Global only.
  • Per-entry maxPopulation on each SpawnEntry.
  • Overall RuntimeSpawner.maxObjectCount across all sources.

Constructor & Destructor Documentation

◆ GlobalSpawnLoop()

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

Member Function Documentation

◆ BuildEligibleEntries()

void MegaCrush.Spawner.GlobalSpawnLoop.BuildEligibleEntries ( List< SpawnEntry > globalSpawners)
private

Filters entries into _eligibleEntries based on per-entry maxPopulation. Uses SpawnEntry.currentPopulation, which should be maintained by the executor.

◆ Run()

IEnumerator MegaCrush.Spawner.GlobalSpawnLoop.Run ( List< SpawnEntry > globalSpawners,
int minGlobalCount,
int maxGlobalCount,
int maxOverallPopulation )

Runs the global spawn loop.

Parameters
globalSpawnersSpawn entries that are allowed to spawn globally.
minGlobalCountDesired minimum number of Global-sourced objects.
maxGlobalCountDesired maximum number of Global-sourced objects.
maxOverallPopulationHard overall cap across all SpawnSources (Global + Region + Wave + Special, etc.).

Member Data Documentation

◆ _eligibleEntries

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

◆ _exec

readonly ISpawnExecutor MegaCrush.Spawner.GlobalSpawnLoop._exec
private

◆ _owner

readonly RuntimeSpawner MegaCrush.Spawner.GlobalSpawnLoop._owner
private

◆ _pop

readonly PopulationTracker MegaCrush.Spawner.GlobalSpawnLoop._pop
private

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