public override void OnInspectorGUI() { serializedObject.Update(); MalbersEditor.DrawDescription("Egg Logic"); EditorGUI.BeginChangeCheck(); { EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { MalbersEditor.DrawScript(script); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.HelpBox("Use Baby Dragons or Scale Up the egg", MessageType.None, true); EditorGUILayout.PropertyField(serializedObject.FindProperty("Dragon"), new GUIContent("Dragon", "the Prefab or Gameobject that contains the little dragon")); EditorGUILayout.PropertyField(serializedObject.FindProperty("preHatchOffset"), new GUIContent("Pre-Hatch Offset")); EditorGUILayout.PropertyField(hatchtype, new GUIContent("Hatch Type")); DragonEgg.HatchType ht = (DragonEgg.HatchType)hatchtype.enumValueIndex; switch (ht) { case DragonEgg.HatchType.None: EditorGUILayout.HelpBox("Just Call the Method CrackEgg() to activate it", MessageType.Info, true); break; case DragonEgg.HatchType.Time: EditorGUILayout.PropertyField(time, new GUIContent("Time", "ammount of Seconds to Hatch")); break; case DragonEgg.HatchType.Input: EditorGUILayout.PropertyField(input, new GUIContent("Input", "Input assigned in the InputManager to Hatch")); break; default: break; } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(serializedObject.FindProperty("OnEggCrack"), new GUIContent("On Egg Crack", "Invoked When the Egg Crack")); } EditorGUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Dragon Egg Values Changed"); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serObj.Update(); DrawDefaultInspector(); DragonEgg MyDragoEgg = (DragonEgg)target; DragonEgg.HatchType ht = (DragonEgg.HatchType)hatchtype.enumValueIndex; switch (ht) { case DragonEgg.HatchType.Key: EditorGUILayout.PropertyField(key, new GUIContent("Key", "Press a Key to Hatch")); break; case DragonEgg.HatchType.Time: EditorGUILayout.PropertyField(time, new GUIContent("Time", "ammount of Seconds to Hatch")); break; case DragonEgg.HatchType.Click: break; case DragonEgg.HatchType.Input: EditorGUILayout.PropertyField(input, new GUIContent("Input", "Input assigned in the InputManager to Hatch")); break; case DragonEgg.HatchType.Event: EditorGUILayout.HelpBox("You can send a message using gameObject.SendMessage('CrackEgg'); ", MessageType.Info); break; default: break; } if (GUILayout.Button(new GUIContent("Change Color", "Change the Egg Material"))) { MyDragoEgg.ChangeColor(MyDragoEgg.EggMesh, MyDragoEgg.EggMeshInside); } serObj.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.BeginVertical(MalbersEditor.StyleBlue); EditorGUILayout.HelpBox("Egg Logic", MessageType.None, true); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); EditorGUI.BeginDisabledGroup(true); script = (MonoScript)EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false); EditorGUI.EndDisabledGroup(); EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.HelpBox("Use Baby Dragons or scale the egg", MessageType.None, true); EditorGUILayout.PropertyField(serializedObject.FindProperty("Dragon"), new GUIContent("Dragon", "the Prefab or Gameobject that contains the little dragon")); //EditorGUILayout.PropertyField(serializedObject.FindProperty("eggAnimation"), new GUIContent("Egg Animation", "Start Animation")); EditorGUILayout.PropertyField(serializedObject.FindProperty("preHatchOffset"), new GUIContent("Pre-Hatch Offset")); EditorGUILayout.PropertyField(hatchtype, new GUIContent("Hatch Type")); DragonEgg.HatchType ht = (DragonEgg.HatchType)hatchtype.enumValueIndex; switch (ht) { case DragonEgg.HatchType.None: EditorGUILayout.HelpBox("Just Call the Method CrackEgg() to activate it", MessageType.Info, true); break; case DragonEgg.HatchType.Time: EditorGUILayout.PropertyField(time, new GUIContent("Time", "ammount of Seconds to Hatch")); break; case DragonEgg.HatchType.Click: break; case DragonEgg.HatchType.Input: EditorGUILayout.PropertyField(input, new GUIContent("Input", "Input assigned in the InputManager to Hatch")); break; default: break; } EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUI.indentLevel++; DE.ShowEvents = EditorGUILayout.Foldout(DE.ShowEvents, "Events"); EditorGUI.indentLevel--; if (DE.ShowEvents) { EditorGUILayout.PropertyField(serializedObject.FindProperty("OnEggCrack"), new GUIContent("On Egg Crack", "Invoked When the Egg Crack")); } EditorGUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Dragon Egg Values Changed"); EditorUtility.SetDirty(target); } serializedObject.ApplyModifiedProperties(); }