Link all nodes together. Store indices in hash map.
Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NavMeshQuery"/> class.
        /// </summary>
        /// <param name="nav">The navigation mesh to query.</param>
        /// <param name="maxNodes">The maximum number of nodes that can be queued in a query.</param>
        /// <param name="rand">A random number generator for use in methods like <see cref="NavMeshQuery.FindRandomPoint()"/></param>
        public NavMeshQuery(TiledNavMesh nav, int maxNodes, Random rand)
        {
            this.nav = nav;

            nodePool = new NodePool(maxNodes/*, MathHelper.NextPowerOfTwo(maxNodes / 4)*/);
            tinyNodePool = new NodePool(64/*, 32*/);
            openList = new PriorityQueue<NavNode>(maxNodes);

            this.rand = rand;

            this.query = new QueryData();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NavMeshQuery"/> class.
        /// </summary>
        /// <param name="nav">The navigation mesh to query.</param>
        /// <param name="maxNodes">The maximum number of nodes that can be queued in a query.</param>
        /// <param name="rand">A random number generator for use in methods like <see cref="NavMeshQuery.FindRandomPoint()"/></param>
        public NavMeshQuery(TiledNavMesh nav, int maxNodes, Random rand)
        {
            this.nav = nav;

            areaCost = new float[byte.MaxValue + 1];
            for (int i = 0; i < areaCost.Length; i++)
                areaCost[i] = 1.0f;

            nodePool = new NodePool(maxNodes/*, MathHelper.NextPowerOfTwo(maxNodes / 4)*/);
            tinyNodePool = new NodePool(64/*, 32*/);
            openList = new PriorityQueue<Node>(maxNodes);

            this.rand = rand;
        }