public void ForEachInPatch(int tileId, WorldSpaceGrid <T> .GridElementCallback callback) { var z = tileId / _tilesZ; var x = (tileId - z * _tilesZ) % _tilesX; Grid.ForEachInRect(x * ItemsPerTile, z * ItemsPerTile, ItemsPerTile, ItemsPerTile, callback); }
public WorldSpaceGridTileSet(WorldSpaceGrid <T> grid, int itemsPerTile) { Grid = grid; ItemsPerTile = itemsPerTile; _tilesX = Mathf.CeilToInt((float)Grid.ResolutionX / ItemsPerTile); _tilesZ = Mathf.CeilToInt((float)Grid.ResolutionZ / ItemsPerTile); TileCount = _tilesX * _tilesZ; _dirtyFlags = new bool[TileCount]; }