protected PathBuffer GetPathBuffer() { InitBufferMgr(); PathBuffer ret = m_BufferMgr.GetObject(); return(ret); }
private void ResetBuffer(PathBuffer buffer) { if (buffer != null) { buffer.SetDataCount(0); } }
public static void StopPathBuffer(PathBuffer buffer) { if (m_Map == null) { return; } m_Map.StorePathBuffer(buffer); }
private PathBuffer CreateBuffer() { PathBuffer buffer = new PathBuffer(); uint[] buf = new uint[m_MaxPathBufferCount]; buffer.Init(buf); return(buffer); }
protected void StorePathBuffer(PathBuffer buffer) { if (buffer == null) { return; } InitBufferMgr(); m_BufferMgr.Store(buffer); }
public PathBuffer _FindPath(Vector3 start, Vector3 end, Vector3 extends, NavmeshQueryFilter filter = null) { var query = this.Query; if (query == null) { return(null); } if (filter == null) { filter = this.DefaultQueryFilter; } NavmeshPoint startPoint; var status = query.GetNearestPoint(start, extends, filter, out startPoint); if (NavUtil.Failed(status)) { return(null); } NavmeshPoint endPoint; status = query.GetNearestPoint(end, extends, filter, out endPoint); if (NavUtil.Failed(status)) { return(null); } PathBuffer pathBuf = GetPathBuffer(); if (pathBuf == null || pathBuf.Buffer == null) { return(null); } try { int dataCount; status = query.FindPath(ref startPoint, ref endPoint, extends, filter, pathBuf.Buffer, out dataCount); if (NavUtil.Failed(status)) { return(null); } pathBuf.SetDataCount(dataCount); return(pathBuf); } catch { StorePathBuffer(pathBuf); } return(null); }