A class in Root.Township, the global namespace.
Server: spawns a random number of items from a distribution at random points in a box, then removes itself. Saved so it can be placed in saves.
Constructors
| Member | What it is |
|---|
RandomSpawnRectangle() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private Distribution distribution | Distribution the spawned prefabs are picked from. |
private int maximum | Exclusive upper bound on the item count. |
private int minimum | Inclusive lower bound on the item count. |
private float minimumUp | Smallest up component of a spawned item's up vector, limiting tilt. |
private Vector3 size | Size of the spawn box in local space, from the object's origin. |
Methods
| Member | What it is |
|---|
override void InitializeAsServer(SpawnData spawnData) | Spawns the items now if the entity is in a chunk, or once it's added to one. |
2 private and internal methods
| Member | What it is |
|---|
private void OnDrawGizmos() | Editor: draws the spawn box in translucent blue. |
private void SpawnItems(Chunk chunk) | Spawns a random count of prefabs from the distribution in the box, tilted no further than minimumUp, then destroys this entity (or clears the distribution if it has no prefab). |