Class SlotGrid
Contains a map that is processable by the Wildtile wave function collapse algorithm.
Before collapse, the slots in the map may contain multiple TransformedModules. After collapse, all slots will either contain exactly one TransformedModule or be marked as a wildcard.
Inheritance
Inherited Members
Namespace: CarbideFunction.Wildtile
Syntax
public class SlotGrid
Constructors
SlotGrid(Vector3Int, Vector3Int)
Create a 3D array of Slots to the size of dimensions
.
Declaration
public SlotGrid(Vector3Int dimensions, Vector3Int originBias)
Parameters
Type | Name | Description |
---|---|---|
Vector3Int | dimensions | The size of the 3D grid of slots |
Vector3Int | originBias | An offset to apply to the RNG when selecting the next slot to collapse and which module to select when collapsing. |
Fields
originBias
The offset to apply to the RNG when selecting the next slot to collapse and which module to select when collapsing.
Declaration
public readonly Vector3Int originBias
Field Value
Type | Description |
---|---|
Vector3Int |
Properties
Dimensions
Get the dimensions of the slot grid in Unity's Vector3Int form.
Declaration
public Vector3Int Dimensions { get; }
Property Value
Type | Description |
---|---|
Vector3Int |
SlotData
Readonly access to the Slots in their native form.
Declaration
public Slot[,, ] SlotData { get; }
Property Value
Type | Description |
---|---|
Slot[,,] |
SlotDataFlattened
Readonly access to the Slots in an enumerated form. C# foreach loops and LINQ operations can work with this property.
Declaration
public IEnumerable<Slot> SlotDataFlattened { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Slot> |
Methods
GetSlot(Int32, Int32, Int32)
Get the Slot from a coordinate.
Declaration
public Slot GetSlot(int x, int y, int z)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | |
System.Int32 | y | |
System.Int32 | z |
Returns
Type | Description |
---|---|
Slot |
GetSlot(Vector3Int)
Get the Slot from a coordinate.
Declaration
public Slot GetSlot(Vector3Int coord)
Parameters
Type | Name | Description |
---|---|---|
Vector3Int | coord |
Returns
Type | Description |
---|---|
Slot |
IsWithinBounds(Vector3Int)
Test whether a coordinate can access a Slot in this SlotGrid.
Declaration
public bool IsWithinBounds(Vector3Int coord)
Parameters
Type | Name | Description |
---|---|---|
Vector3Int | coord |
Returns
Type | Description |
---|---|
System.Boolean |