public void Reset(LPoint iStartPos, LPoint iEndPos, BaseGrid iSearchGrid = null) { openList.Clear(); m_startNode = null; m_endNode = null; if (iSearchGrid != null) { m_searchGrid = iSearchGrid; } m_searchGrid.Reset(); m_startNode = m_searchGrid.GetNodeAt(iStartPos.x, iStartPos.y); m_endNode = m_searchGrid.GetNodeAt(iEndPos.x, iEndPos.y); if (m_startNode == null) { m_startNode = new Node(iStartPos.x, iStartPos.y, true); } if (m_endNode == null) { m_endNode = new Node(iEndPos.x, iEndPos.y, true); } }
public JumpPointParam(BaseGrid iGrid, LPoint iStartPos, LPoint iEndPos, bool iAllowEndNodeUnWalkable = true, bool iCrossCorner = true, bool iCrossAdjacentPoint = true, HeuristicMode iMode = HeuristicMode.EUCLIDEAN) { switch (iMode) { case HeuristicMode.MANHATTAN: m_heuristic = new HeuristicDelegate(Heuristic.Manhattan); break; case HeuristicMode.EUCLIDEAN: m_heuristic = new HeuristicDelegate(Heuristic.Euclidean); break; case HeuristicMode.CHEBYSHEV: m_heuristic = new HeuristicDelegate(Heuristic.Chebyshev); break; default: m_heuristic = new HeuristicDelegate(Heuristic.Euclidean); break; } m_allowEndNodeUnWalkable = iAllowEndNodeUnWalkable; m_crossAdjacentPoint = iCrossAdjacentPoint; m_crossCorner = iCrossCorner; openList = new List <Node>(); m_searchGrid = iGrid; m_startNode = m_searchGrid.GetNodeAt(iStartPos.x, iStartPos.y); m_endNode = m_searchGrid.GetNodeAt(iEndPos.x, iEndPos.y); if (m_startNode == null) { m_startNode = new Node(iStartPos.x, iStartPos.y, true); } if (m_endNode == null) { m_endNode = new Node(iEndPos.x, iEndPos.y, true); } m_useRecursive = false; }
public BaseGrid(BaseGrid b) { m_gridRect = new GridRect(b.m_gridRect); width = b.width; height = b.height; }