/// </summary> public int SearchNonAlloc(Vector3 srcPos, Vector3 destPos, ref Stack <Vector3> pathPos) { NavGraphNode destNode = _graph.FindNearNode(destPos); NavGraphNode srcNode = _graph.FindNearNode(srcPos); NavGraphNode tempNode = null; if (null == pathPos) { return(0); } if (true == this.PossibleLinearMove(srcPos, destPos, GlobalConstants.Layer.Mask.building)) { if (null != pathPos) { pathPos.Clear(); pathPos.Push(destPos); } return(1); } _searchDFS.Init(_graph, srcNode.Index(), destNode.Index()); List <int> pathList = _searchDFS.GetPathToTarget(); //-------- chamto test -------- // string nodeChaine = "nodeChaine : "; // foreach (int node in pathList) // { // nodeChaine += node + "<-"; // } // Debug.Log (nodeChaine); //-------- ------------ -------- pathPos.Clear(); pathPos.Push(destPos); foreach (int node in pathList) { tempNode = _graph.GetNode(node) as NavGraphNode; pathPos.Push(tempNode.Pos()); } //pathPos.Push (srcPos); return(pathPos.Count); }