Skip to main content

GenerationBase

A class in Root.Township, Alta.PAGaC.

Editor test component for the PAGaC grid generator: runs the generation steps on its children and builds the result from an option set.

Constructors​

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

Fields​

9 private and internal fields
MemberWhat it is
private Tag airBacking field for Air.
private GameObject generatedThe object built from the last generation.
private bool isRegeneratingInspector button that regenerates with the same seed.
private bool isRegeneratingWithNewSeedInspector button that regenerates with a random seed.
private OptionSet optionSetOptions used to build the generated grid into objects.
private int seedBacking field for Seed.
private int sizeXBacking field for SizeX.
private int sizeYBacking field for SizeY.
private int sizeZBacking field for SizeZ.

Properties​

MemberWhat it is
Tag Air { get; }The tag for empty cells.
Generator Generator { get; private set; }The grid from the last generation.
int Seed { get; }Random seed for generation.
int SizeX { get; }Grid width in cells.
int SizeY { get; }Grid height in cells.
int SizeZ { get; }Grid depth in cells.

Methods​

3 private and internal methods
MemberWhat it is
private void Generate()Seeds the random state, runs each active child GenerationStep, then builds the object from optionSet as a child.
private void OnDrawGizmos()Draws a small cube in each tagged cell, coloured by its tag.
private void OnValidate()Runs Generate when one of the regenerate buttons is pressed in the inspector, picking a new seed if asked.

Used in​

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