Script Reference

TileCoord.cs

Integer coordinate type used for authoritative tile-space simulation. X maps to world X and Y maps to world Z.

CoreDataGrid
On this page

Overview#

TileCoord is the core coordinate type used by the simulation layer. It represents grid positions using integer X and Y values, where Y maps to the world Z axis in 3D scenes.

Inspector Settings#

TileCoord is a serializable struct, not a component. It has no Inspector settings by itself.

Public API#

ChebyshevDistanceTo(TileCoord other)

Returns distance where diagonal movement counts as one step.

ManhattanDistanceTo(TileCoord other)

Returns distance where only cardinal movement counts.

IsCardinalNeighbor(TileCoord other)

True when the other tile is directly north, south, east, or west.

IsNeighborIncludingDiagonal(TileCoord other)

True when the other tile is adjacent, including diagonals.

Runtime Properties#

XHorizontal tile coordinate mapped to world X.
YVertical grid coordinate mapped to world Z.
IsValidFalse when the coordinate equals TileCoord.Invalid.

Common Usage#

TileCoord tile = new TileCoord(4, 7);

if (tile.IsNeighborIncludingDiagonal(otherTile))
{
    // Tiles are adjacent.
}