Construct() public static method

public static Construct ( Vector3 start, Vector3 end, OnPathDelegate callback = null ) : ABPath
start UnityEngine.Vector3
end UnityEngine.Vector3
callback OnPathDelegate
return ABPath
Exemplo n.º 1
0
        /// <summary>Requests a path to the target.</summary>
        public virtual void SearchPath()
        {
            if (float.IsPositiveInfinity(destination.x))
            {
                return;
            }
            if (onSearchPath != null)
            {
                onSearchPath();
            }

            // This is where the path should start to search from
            var currentPosition = GetFeetPosition();

            // If we are following a path, start searching from the node we will
            // reach next this can prevent odd turns right at the start of the path

            /*if (interpolator.valid) {
             *  var prevDist = interpolator.distance;
             *  // Move to the end of the current segment
             *  interpolator.MoveToSegment(interpolator.segmentIndex, 1);
             *  currentPosition = interpolator.position;
             *  // Move back to the original position
             *  interpolator.distance = prevDist;
             * }*/

            canSearchAgain = false;

            // Create a new path request
            // The OnPathComplete method will later be called with the result
            SetPath(ABPath.Construct(currentPosition, destination, null));
        }
Exemplo n.º 2
0
        /// <summary>\copydoc Pathfinding::IAstarAI::SearchPath</summary>
        public virtual void SearchPath()
        {
            if (float.IsPositiveInfinity(destination.x))
            {
                return;
            }
            if (onSearchPath != null)
            {
                onSearchPath();
            }

            Vector3 start, end;

            CalculatePathRequestEndpoints(out start, out end);

            // Request a path to be calculated from our current position to the destination
            ABPath p = ABPath.Construct(start, end, null);

            SetPath(p);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Call this function to start calculating a path.
 ///
 /// callback will be called when the path has completed.
 /// Callback will not be called if the path is canceled (e.g when a new path is requested before the previous one has completed)
 /// </summary>
 /// <param name="start">The start point of the path</param>
 /// <param name="end">The end point of the path</param>
 /// <param name="callback">The function to call when the path has been calculated</param>
 /// <param name="graphMask">Mask used to specify which graphs should be searched for close nodes. See #Pathfinding.NNConstraint.graphMask. This will override #graphMask for this path request.</param>
 public Path StartPath(Vector3 start, Vector3 end, OnPathDelegate callback, GraphMask graphMask)
 {
     return(StartPath(ABPath.Construct(start, end, null), callback, graphMask));
 }
Exemplo n.º 4
0
 public ABPath GetNewPath(Vector3 start, Vector3 end)
 {
     // Construct a path with start and end points
     return(ABPath.Construct(start, end, null));
 }
Exemplo n.º 5
0
 // Token: 0x060021C3 RID: 8643 RVA: 0x00190364 File Offset: 0x0018E564
 public Path StartPath(Vector3 start, Vector3 end, OnPathDelegate callback)
 {
     return(this.StartPath(ABPath.Construct(start, end, null), callback));
 }
Exemplo n.º 6
0
 public ABPath GetNewPath(Vector3 start, Vector3 end)
 {
     return(ABPath.Construct(start, end, null));
 }
Exemplo n.º 7
0
 /** Call this function to start calculating a path.
  *
  * \param start		The start point of the path
  * \param end		The end point of the path
  * \param callback	The function to call when the path has been calculated
  * \param graphMask	Mask used to specify which graphs should be searched for close nodes. See #Pathfinding.NNConstraint.graphMask. This will override #graphMask for this path request.
  *
  * \a callback will be called when the path has completed.
  * \a Callback will not be called if the path is canceled (e.g when a new path is requested before the previous one has completed) */
 //Good Game
 //public Path StartPath (Vector3 start, Vector3 end, OnPathDelegate callback, int graphMask) {
 public Path StartPath(VInt3 start, VInt3 end, OnPathDelegate callback, int graphMask)
 {
     return(StartPath(ABPath.Construct(start, end, null), callback, graphMask));
 }