Pathfinding.MultiTargetPath.Setup C# (CSharp) Method

Setup() protected method

protected Setup ( Vector3 start, Array targets, Array callbackDelegates, OnPathDelegate callback ) : void
start Vector3
targets Array
callbackDelegates Array
callback OnPathDelegate
return void
		protected void Setup (Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callback) {
			inverted = false;
			this.callback = callback;
			callbacks = callbackDelegates;
			if (callbacks != null && callbacks.Length != targets.Length) throw new System.ArgumentException("The targets array must have the same length as the callbackDelegates array");
			targetPoints = targets;

			originalStartPoint = start;

			startPoint = start;
			startIntPoint = (Int3)start;

			if (targets.Length == 0) {
				FailWithError("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];
			}
		}

Usage Example

Ejemplo n.º 1
0
        public static MultiTargetPath Construct(Vector3 start, Vector3[] targets, OnPathDelegate[] callbackDelegates, OnPathDelegate callback = null)
        {
            MultiTargetPath path = PathPool.GetPath <MultiTargetPath>();

            path.Setup(start, targets, callbackDelegates, callback);
            return(path);
        }
All Usage Examples Of Pathfinding.MultiTargetPath::Setup