Overview
UnitFootprint describes how many tiles a unit occupies. Units without this component are treated as 1x1 by MovementMotor.
The anchor tile is the southwest or bottom-left tile of the footprint. A 2x2 unit occupies the anchor plus the neighboring tiles to the east, north, and northeast.
Inspector Settings
Footprint Type
Defines whether the unit is OneByOne or TwoByTwo.
Public API
GetOccupiedTiles(TileCoord anchorTile)Returns every tile occupied by the footprint at the given anchor.
OccupiesTile(TileCoord tile, TileCoord anchorTile)Returns true if a tile falls inside the footprint.
GetClosestOccupiedTileTo(TileCoord other, TileCoord anchorTile)Useful for range checks against larger units.
AreAllTilesWalkable(TileCoord anchorTile)Returns true if every tile in the footprint is walkable.
CanTraverseFootprint(TileCoord fromAnchor, TileCoord toAnchor)Validates movement for every tile in the footprint.
Runtime Properties
| FootprintType | The selected footprint size. |
|---|---|
| Size | Side length in tiles. OneByOne is 1. TwoByTwo is 2. |
Common Usage
List<TileCoord> occupiedTiles = footprint.GetOccupiedTiles(anchorTile);
if (footprint.AreAllTilesWalkable(anchorTile))
{
// Large unit can fit here.
}