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.LocalAreaSpawner Class Reference

Localized spawn volume that lets the system bias spawning when the player is inside the area. This component does not spawn on its own—it's driven by RuntimeSpawner via region-activation signals. More...

Inheritance diagram for MegaCrush.Spawner.LocalAreaSpawner:

Public Member Functions

bool IsActiveSpawner ()
 Returns whether the player is currently inside this region.
 
void ShowHide (bool showHide)
 Sets whether to draw the region gizmo in the Scene view.
 

Properties

BoxCollider ThisCollider [get, set]
 The collider that defines this region (assigned automatically).
 
List< string > RestrictToNavmeshAreas [get, set]
 Optional list of NavMesh area names to constrain spawn placement in this region.
 
List< SpawnEntryCustomRegionSpawners [get, set]
 Spawner entries that are specific to this region and will be considered when the player is inside.
 
int MaxObjectCount [get]
 Region-level population cap.
 
int MinObjectCount [get]
 Region-level minimum population goal.
 

Events

static Action< LocalAreaSpawner, bool > onPlayerIsInRegion
 Raised when the player enters or leaves any LocalAreaSpawner. The bool indicates presence: true on enter, false on exit.
 

Private Member Functions

void OnEnable ()
 
void Start ()
 
void OnTriggerStay (Collider other)
 
void OnTriggerExit (Collider other)
 
RuntimeSpawnerSettings GetSettings ()
 Loads or creates the editor settings for gizmo appearance.
 
void OnDrawGizmos ()
 Draws the region volume as a gizmo in the Scene view.
 

Private Attributes

BoxCollider thisCollider
 The collider that defines our local region. Set/updated automatically.
 
List< string > restrictToNavmeshAreas = new()
 Optional NavMesh area constraints for this region.
 
int minObjectCount = 1
 Minimum number of objects this region should try to maintain when active.
 
int maxObjectCount = 100
 Maximum number of objects this region should allow when active.
 
List< SpawnEntrycustomRegionSpawners = new()
 Region-specific spawn entries considered while the player is inside.
 
RuntimeSpawner spawner
 Owning runtime spawner discovered at startup.
 
bool isActiveSpawner
 True if the player is currently within this region.
 
string playerTag
 Player tag to compare against colliders entering the trigger.
 
bool showSpawnVolumes = true
 Editor-only toggle to show spawn volume gizmos.
 
RuntimeSpawnerSettings settings
 

Detailed Description

Localized spawn volume that lets the system bias spawning when the player is inside the area. This component does not spawn on its own—it's driven by RuntimeSpawner via region-activation signals.

Requires a BoxCollider set to Collider.isTrigger.

Member Function Documentation

◆ GetSettings()

RuntimeSpawnerSettings MegaCrush.Spawner.LocalAreaSpawner.GetSettings ( )
private

Loads or creates the editor settings for gizmo appearance.

◆ IsActiveSpawner()

bool MegaCrush.Spawner.LocalAreaSpawner.IsActiveSpawner ( )

Returns whether the player is currently inside this region.

◆ OnDrawGizmos()

void MegaCrush.Spawner.LocalAreaSpawner.OnDrawGizmos ( )
private

Draws the region volume as a gizmo in the Scene view.

◆ OnEnable()

void MegaCrush.Spawner.LocalAreaSpawner.OnEnable ( )
private

◆ OnTriggerExit()

void MegaCrush.Spawner.LocalAreaSpawner.OnTriggerExit ( Collider other)
private

◆ OnTriggerStay()

void MegaCrush.Spawner.LocalAreaSpawner.OnTriggerStay ( Collider other)
private

◆ ShowHide()

void MegaCrush.Spawner.LocalAreaSpawner.ShowHide ( bool showHide)

Sets whether to draw the region gizmo in the Scene view.

Parameters
showHideTrue to show; false to hide.

◆ Start()

void MegaCrush.Spawner.LocalAreaSpawner.Start ( )
private

Member Data Documentation

◆ customRegionSpawners

List<SpawnEntry> MegaCrush.Spawner.LocalAreaSpawner.customRegionSpawners = new()
private

Region-specific spawn entries considered while the player is inside.

◆ isActiveSpawner

bool MegaCrush.Spawner.LocalAreaSpawner.isActiveSpawner
private

True if the player is currently within this region.

◆ maxObjectCount

int MegaCrush.Spawner.LocalAreaSpawner.maxObjectCount = 100
private

Maximum number of objects this region should allow when active.

◆ minObjectCount

int MegaCrush.Spawner.LocalAreaSpawner.minObjectCount = 1
private

Minimum number of objects this region should try to maintain when active.

◆ playerTag

string MegaCrush.Spawner.LocalAreaSpawner.playerTag
private

Player tag to compare against colliders entering the trigger.

◆ restrictToNavmeshAreas

List<string> MegaCrush.Spawner.LocalAreaSpawner.restrictToNavmeshAreas = new()
private

Optional NavMesh area constraints for this region.

◆ settings

RuntimeSpawnerSettings MegaCrush.Spawner.LocalAreaSpawner.settings
private

◆ showSpawnVolumes

bool MegaCrush.Spawner.LocalAreaSpawner.showSpawnVolumes = true
private

Editor-only toggle to show spawn volume gizmos.

◆ spawner

RuntimeSpawner MegaCrush.Spawner.LocalAreaSpawner.spawner
private

Owning runtime spawner discovered at startup.

◆ thisCollider

BoxCollider MegaCrush.Spawner.LocalAreaSpawner.thisCollider
private

The collider that defines our local region. Set/updated automatically.

Property Documentation

◆ CustomRegionSpawners

List<SpawnEntry> MegaCrush.Spawner.LocalAreaSpawner.CustomRegionSpawners
getset

Spawner entries that are specific to this region and will be considered when the player is inside.

◆ MaxObjectCount

int MegaCrush.Spawner.LocalAreaSpawner.MaxObjectCount
get

Region-level population cap.

◆ MinObjectCount

int MegaCrush.Spawner.LocalAreaSpawner.MinObjectCount
get

Region-level minimum population goal.

◆ RestrictToNavmeshAreas

List<string> MegaCrush.Spawner.LocalAreaSpawner.RestrictToNavmeshAreas
getset

Optional list of NavMesh area names to constrain spawn placement in this region.

◆ ThisCollider

BoxCollider MegaCrush.Spawner.LocalAreaSpawner.ThisCollider
getset

The collider that defines this region (assigned automatically).

Event Documentation

◆ onPlayerIsInRegion

Action<LocalAreaSpawner, bool> MegaCrush.Spawner.LocalAreaSpawner.onPlayerIsInRegion
static

Raised when the player enters or leaves any LocalAreaSpawner. The bool indicates presence: true on enter, false on exit.


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