Skip to main content

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.

Constructors​

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

Fields​

19 private and internal fields
MemberWhat it is
private float floorThresholdSerialized but not read by this class.
private bool hasIdentityRotationSpawn with no rotation (default true). Overrides the random and face orientation options.
private bool isOrientedWithFaceRotate the spawn to match the surface the raycast hit.
private bool isOrientedWithFaceUpForcedWhen set, skips the 90 degree tilt, so the spawn's forward (not its up) points along the surface normal.
private bool isRaycastDownRaycast downwards (default) or upwards.
private bool isRaycastedRaycast from the picked point to find a surface to spawn on.
private bool isRotationRandomUse a fully random rotation instead of a random turn around Y.
private bool isUsingFloorLayerUse the chunk's floor layer to raise the spawn height.
private float offsetHeight offset for the spawn point, also added above the raycast hit.
private float orientationWeightBlend between a random Y turn (0) and the full surface orientation (1).
private float raycastDistanceHow far to raycast (default 4).
private LayerMask raycastMaskLayers the raycast hits.
private int spawnPointIndexCounter giving each spawn point an index.
private Vector3 spawnPositionPosition of the last spawn point picked.
private Quaternion spawnRotationRotation of the last spawn point picked.
private int spawnSeedSeed worked out for the last spawn point; not passed on.
private PopulationDefinition[] targetPopulationsPopulations that may spawn in this display's area.
private float yNormalMaximumHighest surface normal Y the raycast hit may have.
private float yNormalMinimumLowest surface normal Y the raycast hit may have.

Methods​

MemberWhat 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: