/// <summary> /// Return the tile data at the grid position /// </summary> /// <param name="gridX"></param> /// <param name="gridY"></param> /// <returns></returns> public uint GetTileData(int gridX, int gridY) { TilemapChunk chunk = GetOrCreateTileChunk(gridX, gridY); if (chunk == null) { return(Tileset.k_TileData_Empty); } else { int chunkGridX = (gridX < 0 ? -gridX - 1 : gridX) % k_chunkSize; int chunkGridY = (gridY < 0 ? -gridY - 1 : gridY) % k_chunkSize; if (gridX < 0) { chunkGridX = k_chunkSize - 1 - chunkGridX; } if (gridY < 0) { chunkGridY = k_chunkSize - 1 - chunkGridY; } return(chunk.GetTileData(chunkGridX, chunkGridY)); } }