Skip to main content

GenerationRule

A class in Root.Township, Alta.PAGaC.

A PAGaC rule asset that, where its pattern matches, edits the tag grid with a list of steps (set, remove or clear tags per cell). Used by the generation Constructor.

Constructors​

MemberWhat it is
GenerationRule()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

4 private and internal fields
MemberWhat it is
private int[] serializedStepTagCountsFlattened tag count per step cell, used for Unity serialization.
private Tag[] serializedStepTagsFlattened step tags, used for Unity serialization.
private List<GenerationRule.Step> stepsBacking field for Steps.
private List<Tag>[,,,] stepTagsBacking field for StepTags.

Properties​

MemberWhat it is
List<GenerationRule.Step> Steps { get; }The steps run in order on a match. Set puts the first tag in the cell, Remove clears the cell if its tag is listed, Clear empties it.
List<Tag>[,,,] StepTags { get; }Tag lists indexed by step, x, y and z.

Methods​

MemberWhat it is
void ForceBeforeSerialize()Runs the serialize callback by hand to flatten the tag grids into the serialized arrays.
List<Tag> GetStepTags(int step, int x, int y, int z)The tags a given step uses at one cell of the rule.
void OnValidate()Resizes the tag grids to the current size, configuration and step counts.
3 private and internal methods
MemberWhat it is
private void UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize()Rebuilds the match and step tag grids from the flattened serialized arrays.
private void UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize()Resizes and flattens the match and step tag grids into the serialized arrays.
private void Resize(bool isClearing, ref List<Tag>[,,,] tags, int configurations, int sizeX, int sizeY, int sizeZ)Resizes a four dimensional tag grid, optionally clearing it.

Used in​

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