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]; } }
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); }