// 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); }
// void ResetPathFinder() { CurrentPR = null; CurrentStatus = PathfinderStatus.Incative; AvaliableThread.Abort(); AvaliableThread = null; CurrentNM = null; PFM = null; }
// void DistributePaths() { if (CompleatedRequests.Count == 0) { return; } for (int CRIndex = 0; CRIndex < CompleatedRequests.Count; ++CRIndex) { PathRequest CPR = CompleatedRequests.Dequeue(); CPR.Requestee.RecivePathRequest(CPR); } }
// 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; } }
// 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; } } }
//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); }
//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); }