Beispiel #1
0
        public static void CreateBranch(Spline spline, int connectionPointIndex, bool isInbound)
        {
            Spline branch = SplineEditor.CreateSpline(
                spline.transform.position,
                spline.GetThickness(connectionPointIndex),
                spline.GetTwist(connectionPointIndex),
                spline.GetControlPointMode(connectionPointIndex),
                "Battlehub.Spline.CreateBranch");

            branch.name = "Branch";
            RecordHierarchy(spline, "Battlehub.Spline.CreateBranch");

            spline.SetBranch(branch, connectionPointIndex, isInbound);
            if (isInbound)
            {
                branch.AlignWithNextSpline();
                Selection.activeGameObject = branch.GetSplineControlPoints().First().gameObject;
            }
            else
            {
                branch.AlignWithPrevSpline();
                Selection.activeGameObject = branch.GetSplineControlPoints().Last().gameObject;
            }

            EditorUtility.SetDirty(spline);
        }