Ejemplo n.º 1
0
        public void SubmitFindPath(PathRequest _PR, PathFinderManager _PFM, NodeManager _NM)
        {
            CurrentStatus = PathfinderStatus.Active;
            //Debug.Log("PF:  Request Recived by Pathfinder!");

            CurrentPR = _PR;
            PFM       = _PFM;
            if (CurrentPR == null)
            {
                //Debug.Log("PF:  Incompleate Request, Null PR!");
                CurrentStatus = PathfinderStatus.Incative;
                return;
            }

            if (CurrentPR.PathIsFound == true)
            {
                //Debug.Log("PF:  Path Request has already been solved!!");
                _PFM.CompleatedRequests.Enqueue(CurrentPR);
                CurrentStatus = PathfinderStatus.Incative;
                return;
            }

            if (CurrentPR.StartingNode == null || CurrentPR.TargetNode == null || CurrentPR.Requestee == null)
            {
                //Debug.Log("PF:  Incompleate Request, Null Node/Requetee!");
                CurrentStatus = PathfinderStatus.Incative;
                return;
            }
            else if (CurrentPR.IsBeingProcessed == false && CurrentPR.CompletedPath == null)
            {
                CurrentNM = _NM;
                CurrentPR.IsBeingProcessed = true;
                CallFindPath();
            }
        }
Ejemplo n.º 2
0
 //
 void ResetPathFinder()
 {
     CurrentPR     = null;
     CurrentStatus = PathfinderStatus.Incative;
     AvaliableThread.Abort();
     AvaliableThread = null;
     CurrentNM       = null;
     PFM             = null;
 }
Ejemplo n.º 3
0
 public void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            PathFinderManager TargetTestPFM = (PathFinderManager)target;

            if (GUILayout.Button("Test Direction Search"))
            {
                if (NodeManager.Instance.SetupCompletate)
                {
                    Quadrent Gotquad = NodeManager.Instance.FindQuadrentFromWorldPosition(TargetTestPFM.gameObject.transform.position);
                    Debug.Log(Gotquad.QuadrentPostion);
                }
                else
                {
                    Debug.Log("Wait for NodeManager Setup is compleate");
                }
            }
        }