Struct ChunkCoords
Represents the coordinates of a chunk in the grid.
Implements
Inherited Members
Namespace: TerraProc.Core.Terrain
Assembly: TerraProc.Core.dll
Syntax
public readonly record struct ChunkCoords : IEquatable<ChunkCoords>
Constructors
| Edit this page View SourceChunkCoords(int, int)
Represents the coordinates of a chunk in the grid.
Declaration
public ChunkCoords(int X, int Y)
Parameters
| Type | Name | Description |
|---|---|---|
| int | X | X coordinate of the chunk. |
| int | Y | Y coordinate of the chunk. |
Properties
| Edit this page View SourceX
X coordinate of the chunk.
Declaration
public int X { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
Y
Y coordinate of the chunk.
Declaration
public int Y { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceDeconstruct(out int, out int)
Deconstructs the chunk coordinates into individual X and Y components.
Declaration
public void Deconstruct(out int x, out int y)
Parameters
| Type | Name | Description |
|---|---|---|
| int | x | X coordinate. |
| int | y | Y coordinate. |
ToString()
String representation of the chunk coordinates.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | String in the format "ChunkCoords(X, Y)". |
Overrides
| Edit this page View SourceToTileCoords()
Converts the chunk coordinates to global tile coordinates by multiplying with ChunkSize.
Declaration
public TileCoords ToTileCoords()
Returns
| Type | Description |
|---|---|
| TileCoords | Corresponding global tile coordinates. |
Operators
| Edit this page View Sourceoperator +(ChunkCoords, ChunkCoords)
Addition operator for chunk coordinates.
Declaration
public static ChunkCoords operator +(ChunkCoords a, ChunkCoords b)
Parameters
| Type | Name | Description |
|---|---|---|
| ChunkCoords | a | First operand. |
| ChunkCoords | b | Second operand. |
Returns
| Type | Description |
|---|---|
| ChunkCoords | Sum of the two chunk coordinates. |
explicit operator ChunkCoords((int x, int y))
Explicit conversion from tuple.
Declaration
public static explicit operator ChunkCoords((int x, int y) tuple)
Parameters
| Type | Name | Description |
|---|---|---|
| (int x, int y) | tuple | Tuple containing the X and Y coordinates. |
Returns
| Type | Description |
|---|---|
| ChunkCoords | Chunk coordinates. |
implicit operator (int x, int y)(ChunkCoords)
Implicit conversion to tuple.
Declaration
public static implicit operator (int x, int y)(ChunkCoords cc)
Parameters
| Type | Name | Description |
|---|---|---|
| ChunkCoords | cc | Chunk coordinates. |
Returns
| Type | Description |
|---|---|
| (int x, int y) | Tuple containing the X and Y coordinates. |
operator -(ChunkCoords, ChunkCoords)
Subtraction operator for chunk coordinates.
Declaration
public static ChunkCoords operator -(ChunkCoords a, ChunkCoords b)
Parameters
| Type | Name | Description |
|---|---|---|
| ChunkCoords | a | First operand. |
| ChunkCoords | b |
|
Returns
| Type | Description |
|---|---|
| ChunkCoords | Difference of the two chunk coordinates. |