Skip to main content

MultiSpawner

A class in Root.Township, the global namespace.

Spawner that spawns set counts of several prefabs and distributions into its entity's chunk. Server only.

Constructors​

MemberWhat it is
MultiSpawner()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

4 private and internal fields
MemberWhat it is
private List<int> countBacking field for Count.
private List<Distribution> distributionsBacking field for Distributions.
private bool isAllSameIf true, each distribution rolls once and spawns that one prefab for its whole count.
private List<NetworkPrefab> prefabsBacking field for Prefabs.

Properties​

MemberWhat it is
List<int> Count { get; }Spawn counts: first one per prefab, then one per distribution, in that order.
List<Distribution> Distributions { get; }Distributions to roll prefabs from, using the chunk's biome attributes.
List<NetworkPrefab> Prefabs { get; }Prefabs spawned directly.

Methods​

MemberWhat it is
override void Spawn()Server: spawns every prefab and distribution entry by its count, if the entity is in a chunk. The impact overload does the same and ignores the hit.
void Spawn(ImpactHit impact)Server: spawns every prefab and distribution entry by its count, if the entity is in a chunk. The impact overload does the same and ignores the hit.
1 private and internal method
MemberWhat it is
private void SpawnDistribution(Distribution distribution, int count)Rolls a prefab from the distribution for each count, or rolls once and spawns that prefab count times if isAllSame is set.