Пример #1
0
        public SpatialAStar(TPathNode[,] inGrid)
        {
            SearchSpace      = inGrid;
            Width            = inGrid.GetLength(0);
            Height           = inGrid.GetLength(1);
            m_SearchSpace    = new PathNode[Width, Height];
            m_ClosedSet      = new OpenCloseMap(Width, Height);
            m_OpenSet        = new OpenCloseMap(Width, Height);
            m_CameFrom       = new PathNode[Width, Height];
            m_RuntimeGrid    = new OpenCloseMap(Width, Height);
            m_OrderedOpenSet = new PriorityQueue <PathNode>(PathNode.Comparer);

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    if (inGrid[x, y] == null)
                    {
                        throw new ArgumentNullException();
                    }

                    m_SearchSpace[x, y] = new PathNode(x, y, inGrid[x, y]);
                }
            }
        }
Пример #2
0
        public SpatialAStar(TPathNode[,] inGrid)
        {
            SearchSpace = inGrid;
            Width       = inGrid.GetLength(0);
            Height      = inGrid.GetLength(1);

            _searchSpace    = new PathNode[Width, Height];
            _closedSet      = new OpenCloseMap(Width, Height);
            _openSet        = new OpenCloseMap(Width, Height);
            _cameFrom       = new PathNode[Width, Height];
            _runtimeGrid    = new OpenCloseMap(Width, Height);
            _orderedOpenSet = new PriorityQueue <PathNode>(new PathNode(0, 0, default(TPathNode)));

            for (var x = 0; x < Width; x++)
            {
                for (var y = 0; y < Height; y++)
                {
                    if (inGrid[x, y] == null)
                    {
                        throw new ArgumentNullException();
                    }

                    _searchSpace[x, y] = new PathNode(x, y, inGrid[x, y]);
                }
            }
        }
Пример #3
0
 public void Dispose()
 {
     SearchSpace      = null;
     m_SearchSpace    = null;
     m_ClosedSet      = null;
     m_OpenSet        = null;
     m_CameFrom       = null;
     m_RuntimeGrid    = null;
     m_OrderedOpenSet = null;
 }
Пример #4
0
 public SpatialAStar(PathNode[,] inGrid)
 {
     SearchSpace     = inGrid;
     Width           = inGrid.GetLength(0);
     Height          = inGrid.GetLength(1);
     mSearchSpace    = inGrid;
     mClosedSet      = new OpenCloseMap(Width, Height);
     mOpenSet        = new OpenCloseMap(Width, Height);
     mCameFrom       = new PathNode[Width, Height];
     mRuntimeGrid    = new OpenCloseMap(Width, Height);
     mOrderedOpenSet = new PriorityQueue <PathNode>(PathNode.Comparer);
 }