Skip to main content

PolygonChunkDisplay

A class in Root.Township, Alta.Caves.Displays.

Cave chunk display that builds a height mesh from one Y slice of its layer and traces solid regions into EdgeCollider2D outlines. Probably an older 2D cave display.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private MeshFilter filterThe MeshFilter holding the mesh.
private float lowerLimitCells at or below this value get no triangles.
private Mesh meshThe generated mesh.
private const int MinimumVertexCountOutlines with fewer points than this (20) are dropped unless they touch a chunk corner.
private float scaleHeight multiplier for layer values.
private float upperLimitCells at or above this value count as solid and are outlined.
private int yIndexWhich Y slice of the layer to use.

Properties​

1 private and internal property
MemberWhat it is
private MeshRenderer Renderer { get; set; }The mesh renderer on this object.

Methods​

MemberWhat it is
float GetDepth(MapChunkLayer layer, int x, int z)Height of a cell: its layer value at yIndex times scale.
override void Initialize()Gets the filter, renderer and parent chunk and creates the mesh.
override IEnumerator Render() (iterator)Traces edge colliders around cells at or above upperLimit, then builds triangles for cells between the limits.
1 private and internal method
MemberWhat it is
private void OnDestroy()Cleans up the generated mesh.