public LiquidType GetLiquidType(Vector3 worldPos) { Point2D tileCoord; Point2D chunkCoord; var unitCoord = PositionUtil.GetHeightMapXYForPos(worldPos, out tileCoord, out chunkCoord); var tile = GetTile(tileCoord.X, tileCoord.Y); if (tile == null) { return(LiquidType.None); } var type = tile.GetLiquidType(chunkCoord); if (type != LiquidType.None) { // check if below the liquid height level if (tile.GetLiquidHeight(chunkCoord, unitCoord) > worldPos.Z) { return(type); } } return(LiquidType.None); }
public float GetLiquidHeight(Vector3 worldPos) { Point2D tileCoord; Point2D chunkCoord; var unitCoord = PositionUtil.GetHeightMapXYForPos(worldPos, out tileCoord, out chunkCoord); var tile = GetTile(tileCoord.X, tileCoord.Y); return((tile == null) ? float.MinValue : tile.GetLiquidHeight(chunkCoord, unitCoord)); }