Class FlatArrayIndex
This extension class contains methods for interacting with a flat array as though it were a three dimensional array.
Unity-serializable arrays can only be 1 dimensional - this class allows the user to interact with them in a 3D context.
Inheritance
System.Object
FlatArrayIndex
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: CarbideFunction.Wildtile
Syntax
public static class FlatArrayIndex
Methods
GetFlatArraySize(Vector3Int)
Calculate the size of the flat array that would match the number of elements in a 3D grid of size dimensions
Declaration
public static int GetFlatArraySize(this Vector3Int dimensions)
Parameters
Type | Name | Description |
---|---|---|
Vector3Int | dimensions |
Returns
Type | Description |
---|---|
System.Int32 |
ToFlatArrayIndex(Vector3Int, Vector3Int)
Convert a 3D coordinate into a flat array index given the grid dimensions
Declaration
public static int ToFlatArrayIndex(this Vector3Int coordinate, Vector3Int dimensions)
Parameters
Type | Name | Description |
---|---|---|
Vector3Int | coordinate | The 3D coordinates of the query point. All components must be less than their corresponding |
Vector3Int | dimensions | The 3D dimensions of the grid |
Returns
Type | Description |
---|---|
System.Int32 |