public static bool Converge(SplineBase spline, SplineBase branch, int splineIndex, int branchIndex) { if (spline == branch) { return(false); } if (branch.PrevSpline != null && branch.NextSpline != null) { return(false); } if (branchIndex == 0) { if (branch.PrevSpline != null) { return(false); } RecordHierarchy(spline.Root, "Battlehub.Spline.Converge"); spline.SetBranch(branch, splineIndex, false); EditorUtility.SetDirty(branch); EditorUtility.SetDirty(spline); return(true); } else if (branchIndex == branch.ControlPointCount - 1) { if (branch.NextSpline != null) { return(false); } RecordHierarchy(spline.Root, "Battlehub.Spline.Converge"); spline.SetBranch(branch, splineIndex, true); EditorUtility.SetDirty(branch); EditorUtility.SetDirty(spline); return(true); } else { Debug.LogError("branchIndex should be equal to 0 or branch.ControlPointCount - 1"); return(false); } }
public static bool Converge(SplineBase spline, SplineBase branch, int splineIndex, int branchIndex) { if (spline == branch) { return(false); } if (branch.PrevSpline != null && branch.NextSpline != null) { return(false); } if (branchIndex == 0) { if (branch.PrevSpline != null) { return(false); } spline.SetBranch(branch, splineIndex, false); return(true); } else if (branchIndex == branch.ControlPointCount - 1) { if (branch.NextSpline != null) { return(false); } spline.SetBranch(branch, splineIndex, true); return(true); } else { Debug.LogError("branchIndex should be equal to 0 or branch.ControlPointCount - 1"); return(false); } }