コード例 #1
0
ファイル: EPPathFinder.cs プロジェクト: tzachshabtay/MonoAGS
		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));
		}
コード例 #2
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);            
        }
コード例 #3
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;
        }
コード例 #4
0
ファイル: EPPathFinder.cs プロジェクト: saizant/MonoAGS
        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)));
        }
コード例 #5
0
ファイル: JumpPointFinder.cs プロジェクト: saizant/MonoAGS
        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;
        }
コード例 #6
0
ファイル: JumpPointFinder.cs プロジェクト: saizant/MonoAGS
 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);
     }
 }
コード例 #7
0
ファイル: JumpPointFinder.cs プロジェクト: saizant/MonoAGS
        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);
            }
        }
コード例 #8
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);


        }
コード例 #9
0
 public BaseGrid(BaseGrid b)
 {
     m_gridRect = new GridRect(b.m_gridRect);
     width      = b.width;
     height     = b.height;
 }
コード例 #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]);
				}
			}
		}
コード例 #11
0
ファイル: BaseGrid.cs プロジェクト: tzachshabtay/MonoAGS
 public BaseGrid(BaseGrid b)
 {
     m_gridRect = new GridRect(b.m_gridRect);
     width = b.width;
     height = b.height;
 }