Beispiel #1
0
		private IEnumerable<ILocation> getWalkPoints(BaseGrid grid, ILocation from, ILocation to)
		{
			JumpPointParam input = new JumpPointParam (grid, getPos(from), getPos(to), AllowEndNodeUnwalkable, CrossCorner, CrossAdjacentPoint, Heuristics) { UseRecursive = UseRecursive };
			var cells = JumpPointFinder.FindPath (input);
			if (!SmoothPath) cells = JumpPointFinder.GetFullPath(cells);
			return cells.Select (c => getLocation (c, to.Z));
		}
        public JumpPointParam(BaseGrid iGrid, GridPos iStartPos, GridPos iEndPos, bool iAllowEndNodeUnWalkable = true, 
			bool iCrossCorner = true, bool iCrossAdjacentPoint = true, HeuristicMode iMode = HeuristicMode.EUCLIDEAN)
			: this(iGrid, iAllowEndNodeUnWalkable, iCrossCorner, iCrossAdjacentPoint, iMode)
        {
            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, bool iAllowEndNodeUnWalkable = true, bool iCrossCorner = true, bool iCrossAdjacentPoint=true, HeuristicMode iMode = HeuristicMode.EUCLIDEAN)
        {
			SetHeuristic(iMode);            
            m_allowEndNodeUnWalkable = iAllowEndNodeUnWalkable;
            m_crossAdjacentPoint = iCrossAdjacentPoint;
            m_crossCorner = iCrossCorner;

            openList = new List<Node>();

            m_searchGrid = iGrid;
            m_startNode = null;
            m_endNode = null;
            m_useRecursive = false;
        }
Beispiel #4
0
        private IEnumerable <ILocation> getWalkPoints(BaseGrid grid, ILocation from, ILocation to)
        {
            JumpPointParam input = new JumpPointParam(grid, getPos(from), getPos(to), AllowEndNodeUnwalkable, CrossCorner, CrossAdjacentPoint, Heuristics)
            {
                UseRecursive = UseRecursive
            };
            var cells = JumpPointFinder.FindPath(input);

            if (!SmoothPath)
            {
                cells = JumpPointFinder.GetFullPath(cells);
            }
            return(cells.Select(c => getLocation(c, to.Z)));
        }
Beispiel #5
0
        public JumpPointParam(BaseGrid iGrid, bool iAllowEndNodeUnWalkable = true, bool iCrossCorner = true, bool iCrossAdjacentPoint = true, HeuristicMode iMode = HeuristicMode.EUCLIDEAN)
        {
            SetHeuristic(iMode);
            m_allowEndNodeUnWalkable = iAllowEndNodeUnWalkable;
            m_crossAdjacentPoint     = iCrossAdjacentPoint;
            m_crossCorner            = iCrossCorner;

            openList = new List <Node>();

            m_searchGrid   = iGrid;
            m_startNode    = null;
            m_endNode      = null;
            m_useRecursive = false;
        }
Beispiel #6
0
 public JumpPointParam(BaseGrid iGrid, GridPos iStartPos, GridPos iEndPos, bool iAllowEndNodeUnWalkable = true,
                       bool iCrossCorner = true, bool iCrossAdjacentPoint = true, HeuristicMode iMode = HeuristicMode.EUCLIDEAN)
     : this(iGrid, iAllowEndNodeUnWalkable, iCrossCorner, iCrossAdjacentPoint, iMode)
 {
     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);
     }
 }
Beispiel #7
0
        public void Reset(GridPos iStartPos, GridPos 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 void Reset(GridPos iStartPos, GridPos 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);


        }
Beispiel #9
0
 public BaseGrid(BaseGrid b)
 {
     m_gridRect = new GridRect(b.m_gridRect);
     width      = b.width;
     height     = b.height;
 }
Beispiel #10
0
		private void initGrid(BaseGrid grid, bool[][] array)
		{
			grid.Reset();
			for (int x = 0; x < array.Length; x++)
			{
				for (int y = 0; y < array[0].Length; y++)
				{
					grid.SetWalkableAt(x, y, array[x][y]);
				}
			}
		}
Beispiel #11
0
 public BaseGrid(BaseGrid b)
 {
     m_gridRect = new GridRect(b.m_gridRect);
     width = b.width;
     height = b.height;
 }