protected void Setup (Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callback) {
			inverted = false;
			this.callback = callback;
			callbacks = callbackDelegates;
			
			targetPoints = targets;
			
			originalStartPoint = start;
			//originalEndPoint = end;
			
			startPoint = start;
			startIntPoint = (Int3)start;
			
			if (targets.Length == 0) {
				Error ();
				LogError ("No targets were assigned to the MultiTargetPath");
				return;
			}
			
			endPoint = targets[0];
			
			originalTargetPoints = new Vector3[targetPoints.Length];
			for (int i=0;i<targetPoints.Length;i++) {
				originalTargetPoints[i] = targetPoints[i];
			}
		}
Example #2
0
        public MultiTargetPath(Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callbackDelegate = null)
        {
            inverted = false;
            callback = callbackDelegate;
            callbacks = callbackDelegates;

            pathID = AstarPath.active.GetNextPathID ();

            if (AstarPath.active == null || AstarPath.active.graphs == null) {
                errorLog += "No NavGraphs have been calculated yet - Don't run any pathfinding calls in Awake";
                if (AstarPath.active.logPathResults != PathLog.None) {
                    Debug.LogError (errorLog);
                }
                error = true;
                return;
            }

            targetPoints = targets;

            originalStartPoint = start;
            //originalEndPoint = end;

            startPoint = start;
            startIntPoint = (Int3)start;

            if (targets.Length == 0) {
                error = true;
                errorLog += "No targets were assigned\n";
                return;
            }

            endPoint = targets[0];

            originalTargetPoints = new Vector3[targetPoints.Length];
            for (int i=0;i<targetPoints.Length;i++) {
                originalTargetPoints[i] = targetPoints[i];
            }

            //heuristic = Heuristic.Euclidean;//Heuristic.None;
            //heuristicScale = 1F;
        }
Example #3
0
 protected void Setup(Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callback)
 {
     this.inverted = false;
     this.callback = callback;
     this.callbacks = callbackDelegates;
     this.targetPoints = targets;
     this.originalStartPoint = start;
     this.startPoint = start;
     this.startIntPoint = (Int3)start;
     if (targets.Length == 0)
     {
         base.Error();
         base.LogError("No targets were assigned to the MultiTargetPath");
         return;
     }
     this.endPoint = targets[0];
     this.originalTargetPoints = new Vector3[this.targetPoints.Length];
     for (int i = 0; i < this.targetPoints.Length; i++)
     {
         this.originalTargetPoints[i] = this.targetPoints[i];
     }
 }