Skip to main content

ForestCliffEvaluator

A class in Root.Township, Alta.Forests.

Forest generation modifier that finds cliffs: chains of normal edges where the height drops by at least cliffMinimum. It records points along them for cliff fills to use.

Constructors​

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

Fields​

8 private and internal fields
MemberWhat it is
private float cliffMaximumSerialized but not used in this class.
private float cliffMinimumSmallest height drop across an edge that counts as a cliff.
private List<ForestCliffEvaluator.CliffPoint> cliffPointsBacking field for Points.
private List<List<Path>> cliffsBacking field for Cliffs.
private HashSet<Path> currentEvaluationPaths visited by the current EvaluateCliff walk, to stop loops.
private HashSet<Edge> evaluatedEdges already added to a cliff.
private LayerMask layerMaskTerrain layer mask. Set in Awake but not used in this class.
private float stepXSpacing between cliff points.

Properties​

MemberWhat it is
List<List<Path>> Cliffs { get; }Each cliff found, as an ordered list of downhill paths.
List<ForestCliffEvaluator.CliffPoint> Points { get; }Points spaced along every cliff, with direction and height.

Methods​

MemberWhat it is
override void Modify(ForestGeneration forest)Finds every cliff in the forest, then places a CliffPoint every stepX metres along each one.
3 private and internal methods
MemberWhat it is
private void Awake()Sets the raycast layer mask to Terrain.
private void EvaluateCliff(ForestGeneration forest, List<Path> cliff, Path first)Walks round from a steep path to collect the neighbouring steep paths that form one cliff.
private bool IsLegitimateEdge(ForestGeneration forest, Edge edge)False for edges touching an entrance node.

Used in​

Members of other types that take, return or hold a ForestCliffEvaluator: