Пример #1
0
        public static void DrawSplineInspectorGUI(BezierSpline spline)
        {
            if (spline.Count < 2)
            {
                if (GUILayout.Button("Initialize Spline"))
                {
                    spline.Reset();
                }

                return;
            }

            Color c = GUI.color;

            EditorGUI.BeginChangeCheck();
            bool loop = EditorGUILayout.Toggle("Loop", spline.loop);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "Toggle Loop");
                spline.loop = loop;

                SceneView.RepaintAll();
            }

            EditorGUILayout.Space();

            GUI.color = AUTO_CONSTRUCT_SPLINE_BUTTON_COLOR;

            if (GUILayout.Button("Auto Construct Spline"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Auto Construct Spline");
                }

                spline.AutoConstructSpline();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Auto Construct Spline (method #2)"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Auto Construct Spline");
                }

                spline.AutoConstructSpline2();
                SceneView.RepaintAll();
            }

            GUI.color = c;
        }
Пример #2
0
        public static void DrawSplineInspectorGUI(BezierSpline spline)
        {
            EditorGUI.BeginChangeCheck();
            var curve = EditorGUILayout.CurveField("Influence Width", spline.influenceWidth);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "Edit Spline");
                spline.influenceWidth = curve;
            }

            EditorGUI.BeginChangeCheck();
            var width = EditorGUILayout.FloatField("Base Width", spline.baseWidth);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "Edit Spline");
                spline.baseWidth = width;
            }

            if (spline.Count < 2)
            {
                if (GUILayout.Button("Initialize Spline"))
                {
                    spline.Reset();
                }

                return;
            }

            Color c = GUI.color;

            EditorGUI.BeginChangeCheck();
            bool loop = EditorGUILayout.Toggle("Loop", spline.loop);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "Toggle Loop");
                spline.loop = loop;

                SceneView.RepaintAll();
            }

            EditorGUI.BeginChangeCheck();
            bool drawGizmos = EditorGUILayout.Toggle("Draw Runtime Gizmos", spline.drawGizmos);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "Toggle Draw Gizmos");
                spline.drawGizmos = drawGizmos;

                SceneView.RepaintAll();
            }

            EditorGUILayout.Space();

            GUI.color = AUTO_CONSTRUCT_SPLINE_BUTTON_COLOR;

            if (GUILayout.Button("Construct Linear Path"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Construct Linear Path");
                }

                spline.ConstructLinearPath();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Auto Construct Spline"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Auto Construct Spline");
                }

                spline.AutoConstructSpline();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Auto Construct Spline (method #2)"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Auto Construct Spline");
                }

                spline.AutoConstructSpline2();
                SceneView.RepaintAll();
            }

            GUI.color = c;
        }
Пример #3
0
        public static void DrawSplineInspectorGUI(BezierSpline spline)
        {
            if (spline.Count < 2)
            {
                if (GUILayout.Button("Initialize Spline"))
                {
                    spline.Reset();
                }

                return;
            }

            Color c = GUI.color;

            EditorGUI.BeginChangeCheck();
            bool loop = EditorGUILayout.Toggle("Loop", spline.loop);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "Toggle Loop");
                spline.loop = loop;

                SceneView.RepaintAll();
            }

            EditorGUI.BeginChangeCheck();
            bool drawGizmos = EditorGUILayout.Toggle("Draw Runtime Gizmos", spline.drawGizmos);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "Toggle Draw Gizmos");
                spline.drawGizmos = drawGizmos;

                SceneView.RepaintAll();
            }

            EditorGUILayout.Space();

            GUI.color = AUTO_CONSTRUCT_SPLINE_BUTTON_COLOR;

            if (GUILayout.Button("Construct Linear Path"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Construct Linear Path");
                }

                spline.ConstructLinearPath();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Auto Construct Spline"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Auto Construct Spline");
                }

                spline.AutoConstructSpline();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Auto Construct Spline (method #2)"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Auto Construct Spline");
                }

                spline.AutoConstructSpline2();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Create Spline"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Auto Construct Spline");
                }

                spline.createSpline();
                SceneView.RepaintAll();
            }

            //TrackBuilder trackBuilderScript = (TrackBuilder)target;
            if (GUILayout.Button("Generate Track"))
            {
                //trackBuilderScript.BuildTrack();
            }

            GUI.color = c;
        }
Пример #4
0
        public static void DrawSplineInspectorGUI(BezierSpline spline)
        {
            spline.targetPlayerId = EditorGUILayout.IntField("Target Player ID", spline.targetPlayerId);

            if (spline.targetPlayerId < 0)
            {
                EditorGUILayout.HelpBox("Please set target player id", MessageType.Warning);
            }

            if (spline.Count < 2)
            {
                if (GUILayout.Button("Initialize Spline"))
                {
                    spline.Reset();
                }

                return;
            }

            Color c = GUI.color;

            EditorGUI.BeginChangeCheck();
            bool loop = EditorGUILayout.Toggle("Loop", spline.loop);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "Toggle Loop");
                spline.loop = loop;

                SceneView.RepaintAll();
            }

            EditorGUI.BeginChangeCheck();
            bool drawGizmos = EditorGUILayout.Toggle("Draw Runtime Gizmos", spline.drawGizmos);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(spline, "Toggle Draw Gizmos");
                spline.drawGizmos = drawGizmos;

                SceneView.RepaintAll();
            }

            EditorGUILayout.Space();

            GUI.color = AUTO_CONSTRUCT_SPLINE_BUTTON_COLOR;

            if (GUILayout.Button("Construct Linear Path"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Construct Linear Path");
                }

                spline.ConstructLinearPath();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Auto Construct Spline"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Auto Construct Spline");
                }

                spline.AutoConstructSpline();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Auto Construct Spline (method #2)"))
            {
                for (int i = 0; i < spline.Count; i++)
                {
                    Undo.RecordObject(spline[i], "Auto Construct Spline");
                }

                spline.AutoConstructSpline2();
                SceneView.RepaintAll();
            }

            GUI.color = c;
        }