Skip to main content

ForestChunk

A class in Root.Township, the global namespace.

Streams procedural forests for a LocationChunk: asks each overlapping ForestGenerator for static and dynamic content as the chunk loads and unloads.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private CancellationToken cancellationTokenUnused cancellation token field.
private LocationChunk chunkBacking field for Chunk.
private List<ForestGenerator> inBoundsCache of overlapping generators.
private bool isTerrainModifiedSet after the first generator loads; only the first may modify terrain.
private static Logger loggerNLog logger for this class.

Properties​

MemberWhat it is
LocationChunk Chunk { get; }The location chunk on this object.
IEnumerable<ForestGenerator> Forests { get; }Forest generators whose bounds overlap the chunk, worked out once and cached.

Events​

MemberWhat it is
event Action ClientLoadingFinishedClient: fired when static forest loading has finished for this chunk.

Methods​

4 private and internal methods
MemberWhat it is
private async Task Alta.Chunks.IProceduralGenerationStreamer.LoadDynamic(bool hasGenerated)Requests dynamic forest content from each generator unless the chunk was already generated.
private async Task Alta.Chunks.IProceduralGenerationStreamer.LoadStatic(CancellationToken cancellationToken)Finds overlapping generators, requests static content from each, then fires ClientLoadingFinished on clients.
private void Alta.Chunks.IProceduralGenerationStreamer.UnloadDynamic()Releases dynamic forest content from each generator.
private void Alta.Chunks.IProceduralGenerationStreamer.UnloadStatic()Releases static forest content from each generator.