Skip to main content

RiverCollision

A class in Root.Township, Alta.Forests.

A forest generation step that spawns box trigger colliders along the overground river, which pass enters and exits to a locomotion modifier and a liquid container (wading and filling from the river).

Constructors​

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

Fields​

13 private and internal fields
MemberWhat it is
private bool btnRegenerateInspector button that calls Regenerate.
private float endCapScaleLength scale for a box end where the river starts or finishes.
private float endScaleLength scale for a box end that joins another river path.
private ForestGenerator forestThe forest generator used by Regenerate.
private float horizontalScaleBox width as a multiple of river width.
private bool isShowingBoxesWhen on, the trigger prefab is a visible cube, for debugging.
private LiquidContainerTrigger liquidContainerThe liquid trigger that river enters and exits are forwarded to.
private LocomotionModifier locomotionModifierThe locomotion modifier that river enters and exits are forwarded to.
private float normalOffsetOffset along each box's up direction.
private static TriggerShape prefabShared, inactive trigger box prefab, built once in Initialize.
private List<TriggerShape> spawnedThe trigger boxes spawned so far.
private float verticalOffsetExtra world-up offset for each box.
private float verticalScaleBox height as a multiple of river width.

Methods​

9 private and internal methods
MemberWhat it is
private void Alta.Forests.IForestGeneration.ClearDynamic(LocationChunk chunk)Does nothing.
private void Alta.Forests.IForestGeneration.ClearStatic(LocationChunk chunk)Does nothing.
private void Entered(Collider collider)Passes a collider entering any river trigger to the locomotion modifier and liquid container.
private void Exited(Collider collider)Passes a collider leaving any river trigger to the locomotion modifier and liquid container.
private Task Alta.Forests.IForestGeneration.GenerateDynamic(ForestGeneration forest, LocationChunk chunk)Does nothing.
private Task Alta.Forests.IForestGeneration.GenerateGlobal(ForestGeneration forest)Spawns a box trigger for each overground river path, plus one at each river end, sized from the river width.
private Task Alta.Forests.IForestGeneration.GenerateStatic(ForestGeneration forest, LocationChunk chunk, InstructionSet instruction)Does nothing.
private void Alta.Forests.IForestGeneration.Initialize()Builds the shared trigger box prefab once (a visible cube if isShowingBoxes).
private void Regenerate()Destroys the spawned triggers and runs GenerateGlobal again. Wired to an inspector button.