Skip to main content

StructureCube

A class in Root.Township, the global namespace.

One grid cell of a StructurePart used by the mining base generator. Its side flags say where it connects and what must be next to it.

Constructors​

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

Fields​

10 private and internal fields
MemberWhat it is
private StructureSide airSides of this cell that are open air for neighbours.
private StructureSide connectToAirSides that must face an air side of a neighbouring part for the part to be placed.
private StructureSide connectToSolidSides that must face a solid side of a neighbouring part for the part to be placed.
private StructureSide gatesSides with an opening that a path can pass through; the mine generator links gates between parts.
private int minimumGatesForCullingIf above 0, the mine generator drops the part when fewer than this many of the cell's gates line up with incoming gates.
private StructurePart partParent structure part, found on first gizmo draw.
private StructureSide solidSides of this cell that are solid for neighbours.
private int xCell X position in the part's grid.
private int yCell Y position in the part's grid.
private int zCell Z position in the part's grid.

Properties​

MemberWhat it is
StructureSide Air { get; }Sides that are open air.
StructureSide ConnectToAir { get; }Sides that need air next to them.
StructureSide ConnectToSolid { get; }Sides that need something solid next to them.
StructureSide Gates { get; }Sides that are openings other parts can connect to.
int MinimumGatesForCulling { get; }If above 0, a placed part is dropped when fewer than this many of the cube's gates connect.
StructureSide Solid { get; }Sides that are solid.
int X { get; }Cell X position in the part's grid.
int Y { get; }Cell Y position in the part's grid.
int Z { get; }Cell Z position in the part's grid.

Methods​

MemberWhat it is
void LoadFrom(StructurePart.Cube cube)Copies position and side flags from a StructurePart.Cube.
2 private and internal methods
MemberWhat it is
private void DrawSides(Color color, Vector3 size, Vector3 position, StructureSide sides)Editor: draws a thin coloured box on each side set in the given flags.
private void OnDrawGizmosSelected()Editor: draws the cell and its gate, solid, air and connection sides inside the parent structure part.

Used in​

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