Runtime Spawner 1.5.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.RegionSpawnLibrary Class Referencesealed

Global, designer-authored library that defines rule-based spawn entries for LocalAreaSpawner regions. The RegionPopulationController queries this asset at runtime to resolve each region's LocalAreaSpawner.CustomRegionSpawners based on:

More...

Inheritance diagram for MegaCrush.Spawner.RegionSpawnLibrary:

Classes

struct  Rule
 A single library rule that can contribute a SpawnEntry to a region when its filters match the region's tags and the current director step is within range. More...
 

Public Member Functions

float EvaluateWeight (in Rule rule, int currentStep, int stepsCount)
 Computes this rule's selection weight for sorting purposes given the current step.
 

Static Public Member Functions

static float NormalizeStep (int currentStep, int stepsCount)
 Normalizes a step index to the range 0..1 using stepsCount .
 

Public Attributes

List< Rulerules = new()
 All authored rules. The RegionPopulationController scans this list to build region spawn sets each time the director step changes.
 
List< SpawnEntryfallbackEntries = new()
 Fallback entries used when no rules match a region. Leave empty to produce no entries.
 

Detailed Description

Global, designer-authored library that defines rule-based spawn entries for LocalAreaSpawner regions. The RegionPopulationController queries this asset at runtime to resolve each region's LocalAreaSpawner.CustomRegionSpawners based on:

  • Region tags (semantic string labels supplied by the game).
  • Current SpawnDirector step (0-based).
  • Optional weights by normalized step (0..1).

This lets you add a new enemy once (as a rule) and have it flow to all matching tiles, instead of editing dozens of regions by hand. Rules can either append to a tile's authored list or replace it when matched.

Member Function Documentation

◆ EvaluateWeight()

float MegaCrush.Spawner.RegionSpawnLibrary.EvaluateWeight ( in Rule rule,
int currentStep,
int stepsCount )

Computes this rule's selection weight for sorting purposes given the current step.

Parameters
ruleThe rule to evaluate.
currentStepThe current 0-based SpawnDirector step.
stepsCountThe total number of steps defined by the director's profile (≥ 1). Used to normalize the X axis of rule .Rule.weightByStep.
Returns
A non-negative weight value (0 disables the rule, 1 is neutral). If the curve is unset or empty, returns 1.

◆ NormalizeStep()

static float MegaCrush.Spawner.RegionSpawnLibrary.NormalizeStep ( int currentStep,
int stepsCount )
static

Normalizes a step index to the range 0..1 using stepsCount .

Parameters
currentStepCurrent 0-based step.
stepsCountTotal steps (≥ 1).
Returns
Normalized step in 0..1. If stepsCount ≤ 1, returns 1.

Member Data Documentation

◆ fallbackEntries

List<SpawnEntry> MegaCrush.Spawner.RegionSpawnLibrary.fallbackEntries = new()

Fallback entries used when no rules match a region. Leave empty to produce no entries.

◆ rules

List<Rule> MegaCrush.Spawner.RegionSpawnLibrary.rules = new()

All authored rules. The RegionPopulationController scans this list to build region spawn sets each time the director step changes.


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