Exemplo n.º 1
0
 public AStarParam(StaticGrid iGrid, DiagonalMovement iDiagonalMovement)
 {
     m_searchGrid     = iGrid;
     DiagonalMovement = iDiagonalMovement;
     m_startNode      = null;
     m_endNode        = null;
 }
Exemplo n.º 2
0
 public StaticGrid(StaticGrid b)
 {
     sbyte[,] tMatrix = new sbyte[b.width, b.height];
     for (int widthTrav = 0; widthTrav < b.width; widthTrav++)
     {
         for (int heightTrav = 0; heightTrav < b.height; heightTrav++)
         {
             tMatrix[widthTrav, heightTrav] = b.GetValueAt(widthTrav, heightTrav);
         }
     }
     this.m_nodes = buildNodes(b.width, b.height, tMatrix);
 }
Exemplo n.º 3
0
 public AStarParam(StaticGrid iGrid, Point iStartPos, Point iEndPos, DiagonalMovement iDiagonalMovement) : this(iGrid, iDiagonalMovement)
 {
     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, 0);
     }
     if (m_endNode == null)
     {
         m_endNode = new Node(iEndPos.X, iEndPos.Y, 0);
     }
 }
Exemplo n.º 4
0
        public void Reset(Point iStartPos, Point iEndPos, StaticGrid iSearchGrid = null)
        {
            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, 0);
            }
            if (m_endNode == null)
            {
                m_endNode = new Node(iEndPos.X, iEndPos.Y, 0);
            }
        }