Example #1
0
 public CityGrid(int nCol, int nRow)
 {
     ColCount   = nCol;
     RowCount   = nRow;
     Cells      = new CityCell[nCol, nRow];
     Persons    = new List <Person>();
     _AStarGrid = new NodeGrid(nCol, nRow);
 }
Example #2
0
        public AStar(NodeGrid grid, int startX, int startY, int endX, int endY)
        {
            this._open      = new List <Node>();
            this._closed    = new List <Node>();
            this._grid      = grid;
            this._startNode = grid.nodes[startX, startY];
            this._endNode   = grid.nodes[endX, endY];
            this.path       = new List <Node>();

            heuristic = this.manhattan;

            _startNode.g = 0;
            _startNode.h = heuristic(_startNode);
            _startNode.f = _startNode.g + hMag * _startNode.h;
        }