/// <summary> /// 获取邻居结点 /// </summary> /// <param name="point"></param> /// <param name="allowDiagonal">是否包括斜边</param> /// <returns></returns> public List <PathNode> GetNeighbour(PathNode point, bool allowDiagonal = true) { List <PathNode> temp = new List <PathNode>(); Vector3Int center = point.coord; List <Vector3Int> neighbourCoordinates = center.GetNeightbours(allowDiagonal); foreach (var item in neighbourCoordinates) { if (nodeDict.ContainsKey(item)) { temp.Add(nodeDict[item]); } } return(temp); }