public CellValue GetCellValue(Cell cell) { if (terrainV2 == null) { return(new CellValue { blockType = BlockShape.Empty }); } var v2Id = cell.ToInt3() + GetV2Offset(); if (!terrainV2.IsInBound(v2Id)) { return(new CellValue { blockType = BlockShape.Empty }); } (int style, int shape, int direction) = terrainV2.GetCell(v2Id); if (shape == -1) { return(new CellValue { blockType = BlockShape.Empty }); } else { return(new CellValue { blockType = (BlockShape)(shape + 1), style = (BlockStyle)style, direction = (BlockDirection)direction }); } }