Skip to main content

Rule

A class in Root.Township, Alta.PAGaC.

A PAGaC placement rule: a grid of tag lists per configuration that must match before a part goes in, plus whether it can overlap itself in other rotations. A ScriptableObject that flattens its 4D tag grid for Unity serialization.

Constructors​

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

Fields​

1 private and internal field
MemberWhat it is
private Rule.RotationOverlap rotationOverlapBacking field for Overlap.

Properties​

MemberWhat it is
Rule.RotationOverlap Overlap { get; }Whether the same rule may be placed again in the same cells at another rotation (perpendicular, mirrored, either, all or none).

Methods​

MemberWhat it is
static void DeSerialize(int configurations, int sizeX, int sizeY, int sizeZ, List<Tag>[,,,] tags, Tag[] serializedTags, int[] serializedTagCounts)Fills the 4D tag grid from the flat tag array and per-cell counts.
void ForceBeforeSerialize()Runs the before-serialize step by hand, flattening the tag grid into the serialized arrays.
static void RecreateTags(ref List<Tag>[,,,] tags, int configurations, int sizeX, int sizeY, int sizeZ)Makes a fresh 4D grid of empty tag lists at the given sizes.
static void Resize(bool isClearing, ref List<Tag>[,,,] tags, int configurations, int sizeX, int sizeY, int sizeZ)Recreates the tag grid if its sizes don't match, or clears every list when isClearing is set.
static void Serialize(int configurations, int sizeX, int sizeY, int sizeZ, List<Tag>[,,,] tags, ref Tag[] serializedTags, ref int[] serializedTagCounts)Flattens the 4D tag grid into one tag array plus a count per cell.
3 private and internal methods
MemberWhat it is
private void UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize()After Unity loads the asset, rebuilds the 4D tag grid from the flat arrays.
private void UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize()Before Unity saves the asset, resizes the tag grid and flattens it into the serialized arrays.
private void OnValidate()Editor: resizes the tag grid when sizes or configuration count change.

Used in​

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