A class in Root.Township, the global namespace.
A procedural set piece (an encounter, a camp) placed by forest or cave generation. Its GeneratableParts build static content first and, when the chunk is being generated, dynamic content after.
Constructors
| Member | What it is |
|---|
GenerationCore() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private Logger logger | NLog logger, used to report generation errors. |
private float maximumRadius | Backing field for MaximumRadius, the largest allowed generation radius. |
private float minimumRadius | Backing field for MinimumRadius, the smallest allowed generation radius. |
private GeneratablePart[] parts | Generatable parts run by Generate, set in the prefab. |
private List<GeneratablePart> workingParts | Parts for the current generation: a copy of parts plus any added with AddPart. |
Properties
| Member | What it is |
|---|
Chunk Chunk { get; private set; } | Chunk the core is in: its chunking parent's chunk, or the best chunk at its position. |
NetworkEntity ChunkingParent { get; private set; } | Entity spawned content is chunked under, if any. |
bool IsDynamic { get; private set; } | Whether the core is dynamic. Never set in this code, so always false. |
float MaximumRadius { get; } | Largest radius this core may be placed with. Also used to filter it in distributions. |
float MinimumRadius { get; } | Smallest radius this core may be placed with. |
float Radius { get; private set; } | Radius chosen for this placement. |
int Seed { get; private set; } | Seed passed to Generate. |
SpawnData SpawnData { get; private set; } | Spawn data passed to Generate. |
Methods
| Member | What it is |
|---|
void AddPart(GeneratablePart part) | Adds a part to the list being generated this run. |
void Generate(SpawnData spawnData, NetworkEntity chunkingParent, bool isModifyingTerrain, float radius, int seed = 0) | Runs every part's static generation with the given spawn data, radius and seed. |
void GenerateDynamic() | If the spawn data is generating, runs every part's dynamic generation and the static generation helper. |
override void Release() | Destroys the core's object. |
5 private and internal methods
| Member | What it is |
|---|
private float Alta.Caves.IDistributionValue.Evaluate(AttributeSet set) | Distribution weight: 1 when the set's special biome radius is inside the min and max radius, else 0. |
private void OnDrawGizmos() | Editor: draws the minimum and maximum radius circles. |
private void TestGenerate() | Editor context menu "Test": generates with default spawn data and a random radius. |
private void TestNodeGenerate() | Editor context menu "Test Node": generates as if on the nearest forest node in this chunk. |
private void TestPathGenerate() | Editor context menu "Test Path": generates as if on the nearest forest edge in this chunk. |
Used in
Members of other types that take, return or hold a GenerationCore:
AlignWithPath.GenerateStatic, AlignWithPathSlope.GenerateStatic, AlignWithTerrainSlope.GenerateStatic, ForestGCoreInstruction.GetGcore, RiverGCoreInstruction.RiverGCoreInstruction, DynamicPathPart.GenerateDynamic, GeneratablePart.GenerateDynamic, GeneratablePart.GenerateStatic, GenerationStarter.core, GenerationStarter.prefab, LinearPartClonerPart.GenerateDynamic, LinearPartClonerPart.GenerateStatic, LinearPartClonerPart.Process, LinkerPart.GenerateDynamic, PathEndsPart.GenerateStatic, PointTowardsEachotherPart.GenerateDynamic, RandomRotation3d.GenerateStatic, RandomRotationPart.GenerateStatic, SafetySpline.GenerateStatic, SignPointPart.GenerateStatic, SnapToTerrain.GenerateStatic, SpawnerPart.GenerateDynamic, TerrainOffsetPart.GenerateStatic, TerrainSplatPart.GenerateStatic, TerrainSpline.GenerateStatic.