Example #1
0
        void OnEnable()
        {
            creator = (SnakePathCreator)target;
            lastBezierSegmentInfo = new Types.BezierSegmentInfo();

            if (creator.snakePath != null)
            {
                creator.snakePath.OffsetPosition = creator.transform.position;
                EditorUtility.SetDirty(creator.snakePath);
            }
        }
Example #2
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            SnakePathCreator myScript = (SnakePathCreator)target;

            if (GUILayout.Button("Default Snake Layout"))
            {
                Undo.RecordObject(creator.snakePath, "Create Default Layout");

                myScript.CreateBasicPathSetup();
                SceneView.RepaintAll();
            }

            if (GUILayout.Button("Render Mesh"))
            {
                myScript.RenderPathLayoutToMesh();
            }

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Revert", GUILayout.ExpandWidth(true)))
            {
                RevertSnakePath(new Vector3(-1, -1, 1), creator.snakePath);
            }

            if (GUILayout.Button("Revert Y", GUILayout.ExpandWidth(true)))
            {
                RevertSnakePath(new Vector3(1, -1, 1), creator.snakePath);
            }

            if (GUILayout.Button("Revert X", GUILayout.ExpandWidth(true)))
            {
                RevertSnakePath(new Vector3(-1, 1, 1), creator.snakePath);
            }

            GUILayout.EndHorizontal();

            bool isEnableAutoCtrlP = GUILayout.Toggle(creator.enableAutoContorlPoint, "Enable Auto Ctrl Point");

            if (isEnableAutoCtrlP != creator.enableAutoContorlPoint)
            {
                Undo.RecordObject(creator.snakePath, "Enable Auto Ctrl Point");
                creator.enableAutoContorlPoint = isEnableAutoCtrlP;
            }
        }