Class TilemapData
Contains tilemap data. This is used to be able to manipulate tilemap data without requiring access to the Unity API, which is not possible on any thread that is not the main thread.
Inherited Members
Namespace: InsaneScatterbrain.MapGraph
Syntax
public class TilemapData
Properties
Bounds
Gets the tilemap's bounds.
Declaration
public RectInt Bounds { get; }
Property Value
| Type | Description |
|---|---|
| RectInt |
HexagonalGridOffsetType
Declaration
public HexagonalGridOffsetType HexagonalGridOffsetType { get; set; }
Property Value
| Type | Description |
|---|---|
| HexagonalGridOffsetType |
Tiles
Gets the tiles in the tilemap indexed by position.
Declaration
public IReadOnlyDictionary<Vector2Int, TileBase> Tiles { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<Vector2Int, TileBase> |
Methods
CreateFromTilemap(Tilemap)
Declaration
public static TilemapData CreateFromTilemap(Tilemap tilemap)
Parameters
| Type | Name | Description |
|---|---|---|
| Tilemap | tilemap |
Returns
| Type | Description |
|---|---|
| TilemapData |
GetOffsetAdjustedBounds(Vector2Int)
Gets the bounds based on where it would be placed on a grid. The bounds will differ when it concerns a hexagonal grid for which the shape must be maintained, as some tiles might need to be shifted over.
This method assumes that target coordinates refer to those on a grid with an odd row offset.
Declaration
public RectInt GetOffsetAdjustedBounds(Vector2Int targetCoords)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2Int | targetCoords | The target coordinates. |
Returns
| Type | Description |
|---|---|
| RectInt | The adjusted bounds. |
Reset()
Declaration
public void Reset()
SetTile(Vector2Int, TileBase)
Set tile at given position.
Declaration
public void SetTile(Vector2Int position, TileBase tile)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2Int | position | The position. |
| TileBase | tile | The tile. |
SetTilesBlock(RectInt, TileBase[])
Set a block of tile map data.
Declaration
public void SetTilesBlock(RectInt targetBounds, TileBase[] block)
Parameters
| Type | Name | Description |
|---|---|---|
| RectInt | targetBounds | The bounds. |
| TileBase[] | block | The block of tile to fill the bounds with. |
SetTilesBlock(Vector2Int, TilemapData, ref List<Vector2Int>)
Pastes the content of the given tilemap onto this one, starting at the given coordinates.
Declaration
public void SetTilesBlock(Vector2Int coords, TilemapData tilemap, ref List<Vector2Int> placements)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2Int | coords | The coordinates to place the tilemap on. |
| TilemapData | tilemap | The tilemap to place on. |
| List<Vector2Int> | placements | The positions of tiles placed. |