StructurePart
A class in Root.Township, the global namespace.
A piece that MiningBaseGenerator can place in a generated mine: its size in tiles, the sides that are gates, solid or air, and limits on how low it can be placed.
- Listed in Global namespace: S
- Inherits or implements
MonoBehaviour,IIgnoreForStaticFlatten,IDontSplit - Nested types
Cube
Constructors
| Member | What it is |
|---|---|
StructurePart() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
int x | Public grid coordinate field; not used in this class. |
int y | Public grid coordinate field; not used in this class. |
int z | Public grid coordinate field; not used in this class. |
17 private and internal fields
| Member | What it is |
|---|---|
private StructureSide[,,] air | Per-cell air side flags. Backing field for Air. |
private StructureSide[,,] connectToAir | Per-cell connect-to-air side flags. Backing field for ConnectToAir. |
private StructureSide[,,] connectToSolid | Per-cell connect-to-solid side flags. Backing field for ConnectToSolid. |
private int depth | Size of the part in tiles along z. Default 1. |
private StructureSide[,,] gates | Per-cell gate side flags. Backing field for Gates. |
private int height | Size of the part in tiles along y. Default 1. |
private bool isRequiringGate | When true, MiningBaseGenerator only places the part where a path reaches one of its gates. |
private int maximumDrop | Largest vertical drop MiningBaseGenerator tries when placing the part. No limit by default. |
private int maximumY | Highest tile y the part may be placed at. -1 means no limit. |
private int minimumDrop | Smallest vertical drop MiningBaseGenerator tries when placing the part. |
private int minimumY | Lowest tile y the part may be placed at. Default -1. |
private StructurePart.Cube[] obsolete | Old cube list (formerly cubes), converted to StructureCube children in OnValidate and then cleared. |
private StructureSide[,,] solid | Per-cell solid side flags. Backing field for Solid. |
private StructureCube[] structureCubes | Cached StructureCube children. Backing field for StructureCubes. |
private Transform structureCubesParent | Transform whose children are the part's StructureCube components. |
private StructureType structureType | The StructureType this part belongs to, which sets the tile size. |
private int width | Size of the part in tiles along x. Default 1. |
Properties
| Member | What it is |
|---|---|
StructureSide[,,] Air { get; } | Per-tile flags of sides that are open air. |
StructureSide[,,] ConnectToAir { get; } | Per-tile flags of sides that must touch air. |
StructureSide[,,] ConnectToSolid { get; } | Per-tile flags of sides that must touch solid ground. |
int Depth { get; } | Size in tiles along z. |
StructureSide[,,] Gates { get; } | Per-tile flags of sides that are openings, built from the cubes. |
int Height { get; } | Size in tiles along y. |
bool IsRequiringGate { get; } | If true, the generator only places this part where a path connects to one of its gates. |
int MaximumDrop { get; } | Highest drop the generator will try. No limit when left at int.MaxValue. |
int MaximumY { get; } | Highest tile row the part may be placed at, or -1 for no limit. |
int MinimumDrop { get; } | Lowest drop (in tiles) below the connecting point the generator will try. |
int MinimumY { get; } | Lowest tile row the part may be placed at. |
StructureSide[,,] Solid { get; } | Per-tile flags of sides that are solid. |
StructureCube[] StructureCubes { get; } | The StructureCube children that describe each tile's sides. Found once and cached. |
StructureType StructureType { get; } | The structure type this part belongs to, which sets tile size. |
int Width { get; } | Size in tiles along x. |
Methods
3 private and internal methods
| Member | What it is |
|---|---|
private void InitializeSides() | Builds the per-cell side arrays (gates, solid, air and connect masks) from the child StructureCube components. |
private void OnDrawGizmosSelected() | Editor: draws the part's footprint as a blue box scaled by the structure type's tile size. |
private void OnValidate() | Editor: makes the Structure Cubes parent if missing and turns old serialized Cube entries into StructureCube objects. |
Used in
Members of other types that take, return or hold a StructurePart: