Skip to main content

ForestBridges

A class in Root.Township, Alta.Forests.

Forest generation step that places bridges, as spline instructions, where paths cross rivers.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private bool btnMigrateInspector button for Migrate.
private ForestBridges.Option[] optionsBridge styles with offsets, handle lengths, heights and pick weights.
private float riverWidthMultiplierScales river radius to place the bank lines.
private float totalWeightsSum of option weights, worked out on first use.

Methods​

MemberWhat it is
void ClearStatic(LocationChunk chunk)Does nothing.
void Initialize()Does nothing.
6 private and internal methods
MemberWhat it is
private void Alta.Forests.IForestGeneration.ClearDynamic(LocationChunk chunk)Does nothing.
private Task Alta.Forests.IForestGeneration.GenerateDynamic(ForestGeneration forest, LocationChunk chunk)Does nothing.
private Task Alta.Forests.IForestGeneration.GenerateGlobal(ForestGeneration forest)Does nothing.
private Task Alta.Forests.IForestGeneration.GenerateStatic(ForestGeneration forest, LocationChunk chunk, InstructionSet instructions)For each river crossing in the chunk, finds the path on both banks, picks a weighted bridge option and adds a spline between the banks.
private Path GetOverlap(Edge edge, float pathProgress, Vector2 start, Vector2 end, out float progress)Finds the path (the edge or one leaving its nearer node) that crosses the given bank line, and where.
private void Migrate()Editor button: makes a StaticEnvironmentPieceInstance on each option's display object.