public bool TryGetTileAndPolyByRef(NavPolyId reference, out NavTile tile, out NavPoly poly)
{
tile = null;
poly = null;
if (reference == NavPolyId.Null)
return false;
//Get tile and poly indices
int salt, polyIndex, tileIndex;
idManager.Decode(ref reference, out polyIndex, out tileIndex, out salt);
//Make sure indices are valid
if (tileIndex >= maxTiles)
return false;
if (tileList[tileIndex].Salt != salt)
return false;
if (polyIndex >= tileList[tileIndex].PolyCount)
return false;
//Retrieve tile and poly
tile = tileList[tileIndex];
poly = tileList[tileIndex].Polys[polyIndex];
return true;
}