예제 #1
0
        //
        public void RequestPathFromVec3s(Vector3 _CurrentPos, Vector3 _TargetPos, MovementCommand _Requestee)
        {
            Node StartingNode = NM.FindNodeFromWorldPosition(_CurrentPos);
            Node TargetNode   = NM.FindNodeFromWorldPosition(_TargetPos);

            PathRequest PR = new PathRequest(StartingNode, TargetNode, _Requestee);

            PathRequests.Enqueue(PR);
        }
예제 #2
0
 //
 void ResetPathFinder()
 {
     CurrentPR     = null;
     CurrentStatus = PathfinderStatus.Incative;
     AvaliableThread.Abort();
     AvaliableThread = null;
     CurrentNM       = null;
     PFM             = null;
 }
예제 #3
0
        //
        void DistributePaths()
        {
            if (CompleatedRequests.Count == 0)
            {
                return;
            }

            for (int CRIndex = 0; CRIndex < CompleatedRequests.Count; ++CRIndex)
            {
                PathRequest CPR = CompleatedRequests.Dequeue();
                CPR.Requestee.RecivePathRequest(CPR);
            }
        }
예제 #4
0
 //
 public void RecivePathRequest(PathRequest _CPR)
 {
     if (_CPR.PathIsFound == false)
     {
         CurrentPathStatus = PathRequestStatus.NoneRequested;
         StartCoroutine(Wait(0.25f));
         RequestPath(_CPR.StartingNode, _CPR.TargetNode, _CPR.Requestee);
     }
     else
     {
         WayPoints             = _CPR.CompletedPath;
         CurrentWaypoint       = WayPoints[0];
         CurrentPathStatus     = PathRequestStatus.RecivedAndValid;
         CurrentMovementStatus = MovementStatus.MovingToNextWapoint;
     }
 }
예제 #5
0
 //
 void DesignateRequestsToPathfinder()
 {
     if (PathRequests.Count == 0)
     {
         return;
     }
     for (int PFIndex = 0; PFIndex < PathFinders.Length; ++PFIndex)
     {
         if (PathFinders[PFIndex].CurrentStatus == Pathfinder.PathfinderStatus.Incative)
         {
             PathRequest PR = PathRequests.Dequeue();
             PathFinders[PFIndex].SubmitFindPath(PR, this, NM);
             break;
         }
     }
 }
예제 #6
0
        //This should be queued to be handled when ready to rather than a immediate method call
        public void RequestRandomPathFromVec3(Vector3 _CurrentPos, MovementCommand _Requestee)
        {
            Node StartingNode = NM.FindNodeFromWorldPosition(_CurrentPos);
            Node TargetNode   = NM.GetRandNode();

            int RandAttempts = 0;

            if (TargetNode == null)
            {
                while (TargetNode == null)
                {
                    ++RandAttempts;
                    TargetNode = NM.GetRandNode();
                    if (RandAttempts > 20)
                    {
                        break;
                    }
                }
            }

            PathRequest PR = new PathRequest(StartingNode, TargetNode, _Requestee);

            PathRequests.Enqueue(PR);
        }
예제 #7
0
        //This should be queued to be handled when ready to rather than a immediate method call
        public void RequestPathFromNodes(Node _StartingNode, Node _TargetNode, MovementCommand _Requestee)
        {
            PathRequest PR = new PathRequest(_StartingNode, _TargetNode, _Requestee);

            PathRequests.Enqueue(PR);
        }