/// <summary> /// Seek the specified sPos and ePos. /// </summary> /// <param name="sPos">S position.</param> /// <param name="ePos">E position.</param> public void Seek(Vector3 sPos, Vector3 ePos) { // List <NavTriangle> lst = new List <NavTriangle>(); foreach (Triangle item in this.m_lstTriangle) { NavTriangle navTri = item.CloneNavTriangle(); lst.Add(navTri); //Debug.Log( "src " + item.GetGroupID() + " :" + item.GetNeighbor(0)+"--" + item.GetNeighbor(1) + "--" + item.GetNeighbor(2) ); //Debug.Log( "tar " + navTri.GetGroupID() + " :" + navTri.GetNeighbor(0)+"--" + navTri.GetNeighbor(1) + "--" + navTri.GetNeighbor(2) ); } Seeker.GetInstance().NavMeshData = lst; List <Vector2> lstpath; Vector2 ssPos = new Vector2(sPos.x, sPos.z); Vector2 eePos = new Vector2(ePos.x, ePos.z); Seeker.GetInstance().Seek(ssPos, eePos, out lstpath, 1); //Debug.Log(lstpath.Count + " lstpath"); this.m_lstFindPath = lstpath; }
/// <summary> /// 获取静态实例 /// </summary> /// <returns></returns> public static Seeker GetInstance() { if (s_cInstance == null) s_cInstance = new Seeker(); return s_cInstance; }