private int ChooseRandomDestination() { // Pick a random grid cell. int randomGridCell = Random.Range(0, m_pathGrid.NumberOfCells - 1); if (m_pathGrid.IsNodeBlocked(randomGridCell)) { randomGridCell = ChooseRandomDestination(); } return(randomGridCell); }