示例#1
0
        public static Path BuildImmediate(Map map, Vector start, Vector end, float aggression, bool moveDiognal, float maxDepthDiff, float depthDiffCostMultiplier, Int2D[] disallowedIndexes)
        {
            UtilityMonoBehaviour.CreateInstance();
            Path path = new Path();

            path.Initialise(Pathfinder.FindPathImmediate(start, end, map, aggression, moveDiognal, maxDepthDiff, depthDiffCostMultiplier, disallowedIndexes));
            return(path);
        }
示例#2
0
 public static void CreateInstance()
 {
     if (instance == null)
     {
         instance = new GameObject().AddComponent <UtilityMonoBehaviour>();
         instance.gameObject.name = "Fast Path";
         Que    = new System.Collections.Generic.Queue <System.Collections.IEnumerator>();
         runner = instance.StartCoroutine(FakeUpdate());
     }
 }
示例#3
0
        private static PathRequest RequestPath(Int2D Start, Int2D End, Map map, float estimateAggression, bool moveDiognal, float maxDepthDiff, float depthDiffCostMultiplier, Int2D[] disallowedIndexes, System.Action <Vector[]> OutputMethod)
        {
            if (RequestQue == null)
            {
                RequestQue = new System.Collections.Generic.Queue <PathRequest>();
            }

            UtilityMonoBehaviour.CreateInstance();
            PathRequest request = new PathRequest(Start, End, map, estimateAggression, moveDiognal, maxDepthDiff, depthDiffCostMultiplier, disallowedIndexes, OutputMethod);

            RequestQue.Enqueue(request);

            if (RequestProcessThread == null || !RequestProcessThread.IsAlive)
            {
                RequestProcessThread          = new Thread(ProcessRequests);
                RequestProcessThread.Priority = DefaultPriority;
                RequestProcessThread.Start();
            }

            return(request);
        }
示例#4
0
 private void Initialise(Vector[] path)
 {
     ready     = true;
     this.path = path;
     UtilityMonoBehaviour.Enque(TriggerInitialiseEvent());
 }