コード例 #1
0
 /// <summary>
 /// Destroy, and free memory.
 /// </summary>
 public void Destroy()
 {
     _closedSet.Clear();
     _openSet.Clear();
     _closedSet = null;
     _openSet   = null;
     _aStarGrid = null;
 }
コード例 #2
0
        /// <summary>
        /// Create a new A* path.
        /// </summary>
        /// <param name="aStarGrid">The aStarGrid the path is on.</param>
        /// <param name="start">The starting point on the aStarGrid.</param>
        /// <param name="end">The ending point on the aStarGrid.</param>
        /// <param name="diagonalMovement">Whether diagonal movement is allowed.</param>
        public AStarPath(AStarGrid aStarGrid, Vector2 start, Vector2 end, bool diagonalMovement = true)
        {
            _openSet   = new HashSet <AStarNode>();
            _closedSet = new HashSet <AStarNode>();

            _aStarGrid = aStarGrid;
            Diagonal   = diagonalMovement;

            Reset(start, end);
        }