Skip to main content

MultipleSpawner.SimpleSpawner

A class in Root.Township, the global namespace.

One spawn rule inside a MultipleSpawner: a prefab or random distribution, how many, and which spawn points. Server only; runs from MultipleSpawner.Spawn.

Constructors​

MemberWhat it is
SimpleSpawner()Creates a MultipleSpawner.SimpleSpawner with default values.

Fields​

9 private and internal fields
MemberWhat it is
private int countBacking field for Count (default 1).
private Distribution distributionBacking field for Distribution.
private bool isAllSameBacking field for IsAllSame.
private bool isRotationRandomBacking field for IsRotationRandom (default on).
private SpawnMethod methodBacking field for Method.
private int nextIdIndex of the last spawn point used in sequence mode.
private NetworkPrefab prefabBacking field for Prefab.
private float radiusBacking field for Radius.
private Transform[] spawnPointsBacking field for SpawnPoints.

Properties​

MemberWhat it is
int Count { get; set; }How many to spawn.
Distribution Distribution { get; set; }Random prefab table used when Prefab is null.
bool IsAllSame { get; set; }If on, one random prefab is picked and used for the whole count.
bool IsRotationRandom { get; set; }If on, spawns get a random rotation instead of the spawn point's.
SpawnMethod Method { get; set; }How spawn points are picked: in sequence (looping) or at random.
NetworkPrefab Prefab { get; set; }Fixed prefab to spawn; if null, Distribution picks one each time.
float Radius { get; set; }Radius setting; not used by the spawning code here.
Transform[] SpawnPoints { get; set; }Transforms to spawn at.
2 private and internal properties
MemberWhat it is
private NetworkEntity Entity { get; set; }The spawner's entity, set by Spawn; its chunk and biome are used.
private Transform NextSpawnPoint { get; }Returns the next spawn point based on Method.

Methods​

MemberWhat it is
void Spawn(NetworkEntity entity)Spawns the prefabs into the entity's chunk at the spawn points, using the chunk's biome.
1 private and internal method
MemberWhat it is
private void Spawn(NetworkPrefab prefab, int count)Spawns the prefabs into the entity's chunk at the spawn points, using the chunk's biome.

Used in​

Members of other types that take, return or hold a SimpleSpawner: