Esempio n. 1
0
 /// <summary>
 /// Creates a new instance of the RegisterFaceCommand class.
 /// </summary>
 /// <param name="a">Point a of the triangle.</param>
 /// <param name="b">Point b of the triangle.</param>
 /// <param name="c">Point c of the triangle.</param>
 /// <param name="surface">The target surface.</param>
 /// <param name="handle">The face handle.</param>
 public RegisterFaceCommand(Vector3 a, Vector3 b, Vector3 c,
                            NavigationSurface surface, NavigationFaceWrapper handle)
 {
     this.a       = a;
     this.b       = b;
     this.c       = c;
     this.handle  = handle;
     this.surface = surface;
 }
Esempio n. 2
0
        /// <summary>
        /// Calculates the face path.
        /// </summary>
        /// <param name="request">The request to calculate.</param>
        /// <param name="surface">The surface to be used for calculations.</param>
        /// <returns>The face path in the form of a list.</returns>
        public static List <IImmutableFace> FindFacePath(PathfindingRequest request, NavigationSurface surface)
        {
            int  agentAreaMask = request.areaMask;
            Face start;

            if (request.startFace != null)
            {
                start = (Face)request.startFace;
            }
            else
            {
                start = surface.FindFirstFaceUnderPosition(request.startPosition, agentAreaMask);
            }
            Face end = surface.FindFirstFaceUnderPosition(request.endPosition, agentAreaMask);

            if (start == null || end == null)
            {
                //Debug.Log((start == null) + " " +  (end == null) + " null null FaceAStar");
                return(null);
            }
            else if (start == end)
            {
                //Debug.Log("start == end FaceAStar");
                return(new List <IImmutableFace>()
                {
                    start
                });
            }
            else
            {
                //Debug.Log("process FaceAStar");
                var process = new FaceAStar(start, end, agentAreaMask);
                process.FindFacePath();
                return(process.result);
            }
        }
 /// <summary>
 /// Creates a new instance of the UnregisterFaceCommand class.
 /// </summary>
 /// <param name="handle">The face handle.</param>
 /// <param name="surface">The target surface.</param>
 public UnregisterFaceCommand(NavigationFaceWrapper handle, NavigationSurface surface)
 {
     this.handle  = handle;
     this.surface = surface;
 }