Runtime Spawner 1.3.0
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.SpawnExecutor Class Referencesealed

Default implementation of ISpawnExecutor. Pulls instances from a pool, resolves placement via ISpawnLocator, applies the NavMeshPlacementPolicy from SpawnEntry, activates the instance, and updates population tracking. More...

Inheritance diagram for MegaCrush.Spawner.SpawnExecutor:
MegaCrush.Spawner.ISpawnExecutor

Public Member Functions

 SpawnExecutor (RuntimeSpawner owner, IPoolAdapter pool, ISpawnLocator locator, PopulationTracker pop)
 Creates a new executor bound to a spawner, pool adapter, locator, and population tracker.
 
GameObject Spawn (SpawnEntry entry, SpawnContext ctx)
 Spawns an instance for entry at a position derived from ctx .
Parameters
entrySpawn configuration (prefab, group settings, etc.).
ctxContext describing source, placement hints, and player position.
Returns
The spawned instance (active), or null on failure.

 

Private Member Functions

Vector3 ResolvePosition (SpawnEntry entry, in SpawnContext ctx)
 Chooses a world position based on the context (group, global, region, wave) and delegates to ISpawnLocator. When a wave point is present, passes SpawnContext.HintTags so the locator can prefer matching hints.
 

Static Private Member Functions

static void EnsureEnabler (GameObject go, SpawnEntry entry)
 Ensures a NavMeshReadyEnabler exists and is configured to enable a NavMeshAgent later (used when the policy is NavMeshPlacementPolicy.Prefer).
 

Private Attributes

readonly RuntimeSpawner _owner
 
readonly IPoolAdapter _pool
 
readonly ISpawnLocator _locator
 
readonly PopulationTracker _pop
 

Detailed Description

Default implementation of ISpawnExecutor. Pulls instances from a pool, resolves placement via ISpawnLocator, applies the NavMeshPlacementPolicy from SpawnEntry, activates the instance, and updates population tracking.

Constructor & Destructor Documentation

◆ SpawnExecutor()

MegaCrush.Spawner.SpawnExecutor.SpawnExecutor ( RuntimeSpawner owner,
IPoolAdapter pool,
ISpawnLocator locator,
PopulationTracker pop )

Creates a new executor bound to a spawner, pool adapter, locator, and population tracker.

Parameters
ownerOwning RuntimeSpawner for deferred placement and events.
poolPool adapter used to fetch/return instances.
locatorPlacement service that finds valid world positions.
popPopulation tracker that records alive/culled instances.

Member Function Documentation

◆ EnsureEnabler()

static void MegaCrush.Spawner.SpawnExecutor.EnsureEnabler ( GameObject go,
SpawnEntry entry )
staticprivate

Ensures a NavMeshReadyEnabler exists and is configured to enable a NavMeshAgent later (used when the policy is NavMeshPlacementPolicy.Prefer).

Parameters
goSpawned GameObject.
entrySpawn entry providing NavMesh preferences.

◆ ResolvePosition()

Vector3 MegaCrush.Spawner.SpawnExecutor.ResolvePosition ( SpawnEntry entry,
in SpawnContext ctx )
private

Chooses a world position based on the context (group, global, region, wave) and delegates to ISpawnLocator. When a wave point is present, passes SpawnContext.HintTags so the locator can prefer matching hints.

Parameters
entrySpawn settings (may influence grouping behavior).
ctxContext describing the source and player position.
Returns
Resolved world position. May be NaN if hint-only refusal is in effect.

◆ Spawn()

GameObject MegaCrush.Spawner.SpawnExecutor.Spawn ( SpawnEntry entry,
SpawnContext ctx )

Spawns an instance for entry at a position derived from ctx .

Parameters
entrySpawn configuration (prefab, group settings, etc.).
ctxContext describing source, placement hints, and player position.
Returns
The spawned instance (active), or null on failure.

Implements MegaCrush.Spawner.ISpawnExecutor.

Member Data Documentation

◆ _locator

readonly ISpawnLocator MegaCrush.Spawner.SpawnExecutor._locator
private

◆ _owner

readonly RuntimeSpawner MegaCrush.Spawner.SpawnExecutor._owner
private

◆ _pool

readonly IPoolAdapter MegaCrush.Spawner.SpawnExecutor._pool
private

◆ _pop

readonly PopulationTracker MegaCrush.Spawner.SpawnExecutor._pop
private

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