// coordinate x/y and data x/y is opposite because: // when encoding to binary, the 1st demension of array represents line while the 2nd represents col, that is, // when we say (x, y) in binary data, we mean the xth line and yth col. // in the other hand, when we get tile by coord from binary, for example, coord is c, // in this case, c.x represents col and c.y represents line MapTileVO GetTile(int x, int y, byte[] bytes) { uint data = GetTileBytes(x, y, bytes); MapTileVO re = MapTileVO.TileDecodeLocal(data, new Coord(x, y)); return(re); }
public MapTileVO GetTile(int x, int y) { if (x >= 0 && x < MapConst.MAP_WIDTH && y >= 0 && y < MapConst.MAP_HEIGHT) { #if UNITY_EDITOR if (!useEditorDataSource) { return(MapTileVO.TileDecodeLocal(_tiles[y, x], new Coord(x, y))); } else { return(_editorTiles[y, x]); } #else return(MapTileVO.TileDecodeLocal(_tiles[y, x], new Coord(x, y))); #endif } else { return(null); } }