Runtime Spawner 1.2.5
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 global population between configured bounds. Chooses random SpawnEntry items from the global list and spawns them via the owner’s executor, optionally spawning groups. More...

Public Member Functions

 GlobalSpawnLoop (RuntimeSpawner owner, ISpawnExecutor exec, PopulationTracker pop)
 Constructs the global spawn loop.
 
IEnumerator Run (List< SpawnEntry > globalSpawners, int minCount, int maxCount, int maxPopulation)
 Coroutine that maintains global population: if below maxPopulation , spawns a random number of entries between minCount and maxCount (adjusted by current population). Entries that enable group spawning will spawn additional members parented to the first. The loop ticks according to RuntimeSpawner.GetGlobalTickSeconds.
 

Private Attributes

readonly RuntimeSpawner _owner
 
readonly ISpawnExecutor _exec
 
readonly PopulationTracker _pop
 

Detailed Description

Periodic loop that maintains global population between configured bounds. Chooses random SpawnEntry items from the global list and spawns them via the owner’s executor, optionally spawning groups.

Constructor & Destructor Documentation

◆ GlobalSpawnLoop()

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

Constructs the global spawn loop.

Parameters
ownerOwning RuntimeSpawner providing context and settings.
execExecutor responsible for performing spawns.
popPopulation tracker used for caps and bookkeeping.

Member Function Documentation

◆ Run()

IEnumerator MegaCrush.Spawner.GlobalSpawnLoop.Run ( List< SpawnEntry > globalSpawners,
int minCount,
int maxCount,
int maxPopulation )

Coroutine that maintains global population: if below maxPopulation , spawns a random number of entries between minCount and maxCount (adjusted by current population). Entries that enable group spawning will spawn additional members parented to the first. The loop ticks according to RuntimeSpawner.GetGlobalTickSeconds.

Parameters
globalSpawnersPool of global spawn entries to choose from.
minCountLower bound on desired spawns per tick.
maxCountUpper bound on desired spawns per tick.
maxPopulationHard cap across all alive spawned objects.

Member Data Documentation

◆ _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: