private void ShowStates() { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.LabelField("Mount/Dismount States", EditorStyles.boldLabel); EditorGUILayout.PropertyField(MountOnly, new GUIContent("Mount Only", "The Rider can only Mount when the Animal is on any of these states")); if (MountOnly.boolValue) { MalbersEditor.Arrays(MountOnlyStates); } EditorGUILayout.PropertyField(DismountOnly, new GUIContent("Dismount Only", "The Rider can only Dismount when the Animal is on any of these states")); if (DismountOnly.boolValue) { MalbersEditor.Arrays(DismountOnlyStates); } EditorGUILayout.PropertyField(ForceDismount, new GUIContent("Force Dismount", "The Rider is forced to dismount when the Animal is on any of these states")); if (ForceDismount.boolValue) { MalbersEditor.Arrays(ForceDismountStates); } } EditorGUILayout.EndVertical(); }
public override void OnInspectorGUI() { serializedObject.Update(); MalbersEditor.DrawDescription("Plays the sound matching the physic material on the hit object\nInvoke the method 'PlayMaterialSound'"); EditorGUI.BeginChangeCheck(); { EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { MalbersEditor.DrawScript(script); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.PropertyField(serializedObject.FindProperty("audioSource")); EditorGUILayout.PropertyField(serializedObject.FindProperty("DefaultSound")); EditorGUILayout.EndVertical(); list.DoLayoutList(); if (list.index != -1) { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { SerializedProperty Element = soundbymaterial.GetArrayElementAtIndex(list.index); SerializedProperty SoundElement = Element.FindPropertyRelative("Sounds"); MalbersEditor.Arrays(SoundElement); } EditorGUILayout.EndVertical(); } } EditorGUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "SoundByMat Inspector"); } serializedObject.ApplyModifiedProperties(); }
private void ShowCustom() { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(straightSpine, new GUIContent("Straight Spine", "Straighten the Mount Point to fix the Rider Animation")); if (M.StraightSpine) { EditorGUILayout.PropertyField(StraightSpineOffsetTransform, new GUIContent("Transf Ref", "Transform to use for the Point Offset Calculation")); EditorGUILayout.PropertyField(pointOffset, new GUIContent("Point Offset", "Point in front of the Mount to Straight the Spine of the Rider")); EditorGUILayout.PropertyField(smoothSM, new GUIContent("Smoothness", "Smooth changes between the rotation and the straight Mount")); } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.PropertyField(UseSpeedModifiers, new GUIContent("Animator Speeds", "Use this for other animals but the horse")); helpUseSpeeds = GUILayout.Toggle(helpUseSpeeds, "?", EditorStyles.miniButton, GUILayout.Width(18)); } EditorGUILayout.EndHorizontal(); if (M.UseSpeedModifiers) { if (helpUseSpeeds) { EditorGUILayout.HelpBox("Changes the Speed on the Rider's Animator to Sync with the Animal Animator.\nThe Original Riding Animations are meant for the Horse. Only change the Speeds for other creatures", MessageType.None); } MalbersEditor.Arrays(SpeedMultipliers, new GUIContent("Animator Speed Multipliers", "Velocity changes for diferent Animation Speeds... used on other animals")); } } EditorGUILayout.EndVertical(); }
public override void OnInspectorGUI() { serializedObject.Update(); MalbersEditor.DrawDescription("Toggle || Swap Meshes"); EditorGUI.BeginChangeCheck(); { EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { MalbersEditor.DrawScript(script); { list.DoLayoutList(); if (showMeshesList.boolValue) { if (list.index != -1) { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { SerializedProperty Element = activeMeshesList.GetArrayElementAtIndex(list.index); MalbersEditor.Arrays(Element); } EditorGUILayout.EndVertical(); } } } } EditorGUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Active Meshes Inspector"); //EditorUtility.SetDirty(target); } serializedObject.ApplyModifiedProperties(); }
private void ShowAbilities() { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(CloneAbilities, new GUIContent("Clone Abilities", "If you are using more than one rider, enable this option")); MalbersEditor.Arrays(CombatAbilities, new GUIContent("Rider Combat Abilities", "")); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUI.indentLevel++; M.Editor_ShowAbilities = EditorGUILayout.Foldout(M.Editor_ShowAbilities, "Abilities Properties"); EditorGUI.indentLevel--; if (M.Editor_ShowAbilities) { if (M.CombatAbilities != null) { foreach (var combatAbility in M.CombatAbilities) { if (combatAbility != null) { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField(combatAbility.name, EditorStyles.toolbarButton); //EditorGUILayout.Separator(); DrawAbility(combatAbility); EditorGUILayout.EndVertical(); } } } } } EditorGUILayout.EndVertical(); }
public override void OnInspectorGUI() { serializedObject.Update(); MalbersEditor.DrawDescription("Adjust the Blend Shapes on the Mesh"); EditorGUI.BeginChangeCheck(); { EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { MalbersEditor.DrawScript(script); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUI.BeginChangeCheck(); { EditorGUILayout.PropertyField(mesh); } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); M.SetShapesCount(); EditorUtility.SetDirty(target); } MalbersEditor.Arrays(LODs, new GUIContent("LODs", "Other meshes with Blend Shapes to change")); } EditorGUILayout.EndVertical(); int Length = 0; if (mesh.objectReferenceValue != null) { Length = M.mesh.sharedMesh.blendShapeCount; } EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { if (Length > 0) { int pin = serializedObject.FindProperty("PinnedShape").intValue; EditorGUILayout.LabelField(new GUIContent("Pin Shape: (" + pin + ") |" + M.mesh.sharedMesh.GetBlendShapeName(pin) + "|", "Current Shape Store to modigy When accesing public methods from other scripts")); } } EditorGUILayout.EndVertical(); if (Length > 0) { if (M.blendShapes == null) { M.blendShapes = M.GetBlendShapeValues(); serializedObject.ApplyModifiedProperties(); } for (int i = 0; i < Length; i++) { var bs = blendShapes.GetArrayElementAtIndex(i); if (bs != null && M.mesh.sharedMesh != null) { bs.floatValue = EditorGUILayout.Slider("(" + i.ToString("D2") + ") " + M.mesh.sharedMesh.GetBlendShapeName(i), bs.floatValue, 0, 100); } //EditorUtility.SetDirty(M.mesh); } EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(preset, new GUIContent("Preset", "Saves the Blend Shapes values to a scriptable Asset")); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.LabelField("On Start", EditorStyles.boldLabel); EditorGUI.BeginDisabledGroup(preset.objectReferenceValue == null); EditorGUILayout.PropertyField(LoadPresetOnStart, new GUIContent("Load Preset", "Load a Blend Shape Preset on Start")); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(preset.objectReferenceValue != null && LoadPresetOnStart.boolValue); EditorGUILayout.PropertyField(random, new GUIContent("Random", "Make Randoms Blend Shapes at start")); EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginHorizontal(); { if (GUILayout.Button("Reset")) { //Undo.RecordObject(target, "Reset Blend Shape"); // Undo.RecordObject(M.mesh, "Reset Blend Shape"); for (int i = 0; i < Length; i++) { blendShapes.GetArrayElementAtIndex(i).floatValue = 0; } // EditorUtility.SetDirty(M.mesh); // M.UpdateBlendShapes(); } if (GUILayout.Button("Randomize")) { // Undo.RecordObject(target, "Randomize Blend Shape"); // Undo.RecordObject(M.mesh, "Randomize Blend Shape"); for (int i = 0; i < Length; i++) { blendShapes.GetArrayElementAtIndex(i).floatValue = Random.Range(0, 100); } // M.UpdateBlendShapes(); // EditorUtility.SetDirty(M.mesh); } if (GUILayout.Button("Save")) { if (preset.objectReferenceValue == null) { string newBonePath = EditorUtility.SaveFilePanelInProject("Create New Blend Preset", "BlendShape preset", "asset", "Message"); BlendShapePreset bsPreset = CreateInstance <BlendShapePreset>(); AssetDatabase.CreateAsset(bsPreset, newBonePath); preset.objectReferenceValue = bsPreset; serializedObject.ApplyModifiedProperties(); Debug.Log("New Blend Shape Preset Created"); M.SaveBlendShapePreset(); } else { if (EditorUtility.DisplayDialog("Overwrite Blend Shape Preset", "Are you sure to overwrite the preset?", "Yes", "No")) { M.SaveBlendShapePreset(); } } //EditorUtility.SetDirty(M); //EditorUtility.SetDirty(M.preset); } EditorGUI.BeginDisabledGroup(preset.objectReferenceValue == null); { if (GUILayout.Button("Load")) { if (preset.objectReferenceValue != null) { if (M.preset.blendShapes == null || M.preset.blendShapes.Length == 0) { Debug.LogWarning("The preset " + M.preset.name + " is empty, Please use a Valid Preset"); } else { M.LoadBlendShapePreset(); EditorUtility.SetDirty(target); } } } } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Blend Shapes Changed"); if (M.mesh) { Undo.RecordObject(M.mesh, "Blend Shapes Changed"); } M.UpdateBlendShapes(); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); MalbersEditor.DrawDescription("Save/Load Bones Transormations into a Preset"); EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { MalbersEditor.DrawScript(script); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(preset); bool disable_ = preset.objectReferenceValue == null; EditorGUILayout.BeginHorizontal(); { if (GUILayout.Button("New Preset")) { string newBonePath = EditorUtility.SaveFilePanelInProject("Create New Bone Preset", "new bone preset", "asset", "Message"); BonePreset bonePreset = CreateInstance <BonePreset>(); AssetDatabase.CreateAsset(bonePreset, newBonePath); preset.objectReferenceValue = bonePreset; EditorUtility.SetDirty(target); Debug.Log("New Bone Preset Created"); } EditorGUI.BeginDisabledGroup(disable_); { if (GUILayout.Button("Save")) { M.SavePreset(); } if (GUILayout.Button("Load")) { M.LoadPreset(); } } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.LabelField("Bones (" + M.Bones.Count.ToString() + ")"); EditorGUI.BeginChangeCheck(); { EditorGUILayout.PropertyField(Root); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Root Changed"); EditorUtility.SetDirty(M); serializedObject.ApplyModifiedProperties(); M.SetBones(); } MalbersEditor.Arrays(serializedObject.FindProperty("Filter"), new GUIContent("Filter|Not Include bones with names|")); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { MalbersEditor.Arrays(serializedObject.FindProperty("Bones")); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }
private void DrawGeneral() { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(StartMounted, new GUIContent("Start Mounted", "Set an animal to start mounted on it")); EditorGUILayout.PropertyField(MountStored, new GUIContent("Stored Mount", "If Start Mounted is Active this will be the Animal to mount")); if (M.StartMounted && MountStored.objectReferenceValue == null) { EditorGUILayout.HelpBox("Select a Animal with 'IMount' interface from the scene if you want to start mounted on it", MessageType.Warning); } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(Parent, G_Parent); EditorGUILayout.PropertyField(LinkUpdate, new GUIContent("Link Update", "Updates Everyframe the position and rotation of the rider to the Animal Mount Point")); EditorGUILayout.PropertyField(DismountType, G_DismountType); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { CreateColliderMounted.boolValue = EditorGUILayout.ToggleLeft(G_CreateColliderMounted, CreateColliderMounted.boolValue); if (CreateColliderMounted.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Center Y", GUILayout.MinWidth(40)); EditorGUILayout.LabelField("Height", GUILayout.MinWidth(40)); EditorGUILayout.LabelField("Radius", GUILayout.MinWidth(40)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(Col_Center, GUIContent.none); EditorGUILayout.PropertyField(Col_height, GUIContent.none); EditorGUILayout.PropertyField(Col_radius, GUIContent.none); EditorGUILayout.EndHorizontal(); EditorGUILayout.PropertyField(Col_Trigger, new GUIContent("Is Trigger")); EditorGUI.indentLevel--; } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(DisableComponents, G_DisableComponents); if (M.DisableComponents) { MalbersEditor.Arrays(DisableList, G_DisableList); if (M.DisableList != null && M.DisableList.Length == 0) { EditorGUILayout.HelpBox("If 'Disable List' is empty , it will disable all Monovehaviours while riding", MessageType.Info); } } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(CallAnimalA, new GUIContent("Call Animal", "Sound to call the Stored Animal")); EditorGUILayout.PropertyField(StopAnimalA, new GUIContent("Stop Animal", "Sound to stop calling the Stored Animal")); EditorGUILayout.PropertyField(RiderAudio, new GUIContent("Audio Source", "The reference for the audio source")); } EditorGUILayout.EndVertical(); }