SpawnAreaDisplay
A class in Root.Township, Alta.Populations.
A cave generation display that registers its layer as spawn space for chosen populations, then picks spawn points in it. Server only.
- Listed in World generation
- Inherits or implements
MapChunkDisplay
Constructors
| Member | What it is |
|---|---|
SpawnAreaDisplay() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
19 private and internal fields
| Member | What it is |
|---|---|
private float floorThreshold | Serialized but not read by this class. |
private bool hasIdentityRotation | Spawn with no rotation (default true). Overrides the random and face orientation options. |
private bool isOrientedWithFace | Rotate the spawn to match the surface the raycast hit. |
private bool isOrientedWithFaceUpForced | When set, skips the 90 degree tilt, so the spawn's forward (not its up) points along the surface normal. |
private bool isRaycastDown | Raycast downwards (default) or upwards. |
private bool isRaycasted | Raycast from the picked point to find a surface to spawn on. |
private bool isRotationRandom | Use a fully random rotation instead of a random turn around Y. |
private bool isUsingFloorLayer | Use the chunk's floor layer to raise the spawn height. |
private float offset | Height offset for the spawn point, also added above the raycast hit. |
private float orientationWeight | Blend between a random Y turn (0) and the full surface orientation (1). |
private float raycastDistance | How far to raycast (default 4). |
private LayerMask raycastMask | Layers the raycast hits. |
private int spawnPointIndex | Counter giving each spawn point an index. |
private Vector3 spawnPosition | Position of the last spawn point picked. |
private Quaternion spawnRotation | Rotation of the last spawn point picked. |
private int spawnSeed | Seed worked out for the last spawn point; not passed on. |
private PopulationDefinition[] targetPopulations | Populations that may spawn in this display's area. |
private float yNormalMaximum | Highest surface normal Y the raycast hit may have. |
private float yNormalMinimum | Lowest surface normal Y the raycast hit may have. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Does nothing. |
override IEnumerator Render() (iterator) | Server: registers this display's layer (and floor layer if used) as spawn information for each target population in the chunk's ecosystem. |
SpawnPoint Spawn(MapChunkLayer layer, MapChunkLayer floor, int x, int z) | Picks a spawn point near a layer cell, with optional raycast to a surface and rotation rules. Returns null if the raycast misses or the slope is out of range. |
Used in
Members of other types that take, return or hold a SpawnAreaDisplay: