/// <summary> /// Returns a NavMeshTileGraphNode reset and ready for use. When no longer needed, /// should be returned to the factory through RecycleNode. /// </summary> /// <returns>A NavMeshTileGraphNode reset and ready for use.</returns> public GraphNode GetNode() { NavMeshTileGraphNode node = mUnusedNavMeshTileGraphNodes.Dequeue(); #if DEBUG node.mInUse = true; #endif // DEBUG return(node); }
/// <summary> /// Constructor. /// </summary> public NavMeshTileGraphNodeFactory() { const Int32 num = 10000; mUnusedNavMeshTileGraphNodes = new Queue<NavMeshTileGraphNode>(num); for (Int32 i = 0; i < num; i++) { NavMeshTileGraphNode temp = new NavMeshTileGraphNode(); mUnusedNavMeshTileGraphNodes.Enqueue(temp); } }
/// <summary> /// Constructor. /// </summary> public NavMeshTileGraphNodeFactory() { const Int32 num = 10000; mUnusedNavMeshTileGraphNodes = new Queue <NavMeshTileGraphNode>(num); for (Int32 i = 0; i < num; i++) { NavMeshTileGraphNode temp = new NavMeshTileGraphNode(); mUnusedNavMeshTileGraphNodes.Enqueue(temp); } }
/// <summary> /// Walks the the Graph starting at <paramref name="node"/> and visiting all its neighbours, /// and then their neighbours and so on. Limited recursive depth to avoid blowing the callstack. /// </summary> /// <param name="node">The node to start the search at.</param> /// <param name="depth">The current depth. Leave empty.</param> public void DebugWalkGraphForErrors(NavMeshTileGraphNode node, Int32 depth = 0) { System.Diagnostics.Debug.Assert(node.mInUse, "Node not in use!"); if (depth >= 1) { return; } for (Int32 i = 0; i < node.pNeighbours.Count; i++) { DebugWalkGraphForErrors(node.pNeighbours[i].mGraphNode as NavMeshTileGraphNode, depth + 1); } }
/// <summary> /// Walks the the Graph starting at <paramref name="node"/> and visiting all its neighbours, /// and then their neighbours and so on. Limited recursive depth to avoid blowing the callstack. /// </summary> /// <param name="node">The node to start the search at.</param> /// <param name="depth">The current depth. Leave empty.</param> public void DebugWalkGraphForErrors(NavMeshTileGraphNode node, Int32 depth) { System.Diagnostics.Debug.Assert(node.mInUse, "Node not in use!"); if (depth >= 1) { return; } for (Int32 i = 0; i < node.pNeighbours.Count; i++) { DebugWalkGraphForErrors(node.pNeighbours[i].mGraphNode as NavMeshTileGraphNode, depth + 1); } }