Example #1
0
        public override void OnInspectorGUI()
        {
            TerrainRampMaker trm = (TerrainRampMaker)target;

            DrawDefaultInspector();

            GUILayout.BeginVertical();

            GUI.color = Color.white;
            if (trm.GetCount() < 2)
            {
                GUI.color = Color.yellow;
                GUILayout.Label("ERROR: Need at least two children points for a ramp.");
            }
            else
            {
                if (trm.AllOnSameTerrain)
                {
                    GUILayout.Label("Adjust settings below.");

                    if (GUILayout.Button("CUT STRAIGHT RAMP"))
                    {
                        trm.CutStraightRamp();
                    }
                }
                else
                {
                    GUI.color = Color.yellow;
                    GUILayout.Label("ERROR: All points must drop to the same terrain!");
                }
            }
            GUI.color = Color.white;

            GUILayout.EndVertical();
        }
Example #2
0
        void OnSceneGUI()
        {
            TerrainRampMaker trm = (TerrainRampMaker)target;

            for (int i = 0; i < trm.GetCount(); i++)
            {
                var tr = trm.GetChild(i);

                EditorGUI.BeginChangeCheck();
                Vector3 position = Handles.PositionHandle(tr.position, Quaternion.identity);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(tr, "Move Ramp Control Point");
                    tr.position = position;
                }
            }
        }