Ejemplo n.º 1
0
        // private readonly GUIContent G_DismountMountOnDeath = new GUIContent("Dismount if mount dies", "The Rider will automatically dismount if the Animal Dies");
        #endregion

        public override void OnInspectorGUI()
        {
            MalbersEditor.DrawDescription("Riding Logic");
            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            MalbersEditor.DrawScript(script);

            serializedObject.Update();

            Editor_Tabs1.intValue = GUILayout.Toolbar(Editor_Tabs1.intValue, new string[] { "General", "Events", "Advanced", "Debug" });


            int Selection = Editor_Tabs1.intValue;

            if (Selection == 0)
            {
                DrawGeneral();
            }
            else if (Selection == 1)
            {
                DrawEvents();
            }
            else if (Selection == 2)
            {
                DrawAdvanced();
            }
            else if (Selection == 3)
            {
                DrawDebug();
            }

            serializedObject.ApplyModifiedProperties();
            EditorGUILayout.EndVertical();

            AddMountLayer();
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            MalbersEditor.DrawDescription("Guns Weapons Properties");

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                CommonWeaponProperties();

                GunCustomInspector();

                SoundsList();
                EventList();
                CheckWeaponID();
            }
            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Gun Inspector");
                EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            MalbersEditor.DrawDescription("Brain Logic for the Animal");
            EditorGUILayout.BeginVertical(MTools.StyleGray);
            {
                Editor_Tabs1.intValue = GUILayout.Toolbar(Editor_Tabs1.intValue, Tabs1);


                if (Editor_Tabs1.intValue == 1)
                {
                    DrawReferences();
                }
                else if (Editor_Tabs1.intValue == 0)
                {
                    DrawAIStates();
                }
                else
                {
                    DrawEvents();
                }


                //EditorGUILayout.PropertyField(debug);
            }
            EditorGUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Send Messages to all the MonoBehaviours that uses the Interface |IAnimatorListener| ");

            EditorGUI.BeginChangeCheck();
            {
                EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
                {
                    MalbersEditor.DrawScript(script);

                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    list.DoLayoutList();
                    EditorGUILayout.EndVertical();

                    var UseSendMessage = serializedObject.FindProperty("UseSendMessage");
                    UseSendMessage.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Use Send Message", "Uses the SendMessage() instead"), UseSendMessage.boolValue);
                    var nextFrame = serializedObject.FindProperty("nextFrame");
                    nextFrame.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Next Frame", "Send the Message the frame after"), nextFrame.boolValue);
                }

                EditorGUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Messages Inspector");
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 6
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            MalbersEditor.DrawDescription("AI Logic that uses the NavMesh Agent to move the Animal");

            EditorGUI.BeginChangeCheck();
            {
                EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);

                Editor_Tabs1.intValue = GUILayout.Toolbar(Editor_Tabs1.intValue, new string[] { "General", "Events", "Debug" });

                int Selection = Editor_Tabs1.intValue;

                if (Selection == 0)
                {
                    ShowGeneral();
                }
                else if (Selection == 1)
                {
                    ShowEvents();
                }
                else if (Selection == 2)
                {
                    ShowDebug();
                }


                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(target, "Animal AI Control Changed");
                }
            }
            EditorGUILayout.EndVertical();
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 7
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            MalbersEditor.DrawDescription("Used for catch when a gameobject enters, stays, or Exit A collider/Trigger");

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("active"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ignoreTriggers"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("hitLayer"), new GUIContent("Hit Layers", "GameObjects to Ignore with this layers"));
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnTrigger_Enter"), new GUIContent("On Trigger Enter"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnTrigger_Stay"), new GUIContent("On Trigger Stay"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnTrigger_Exit"), new GUIContent("On Trigger Exit"));
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 8
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Strafing Logic");

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);

            MalbersEditor.DrawScript(script);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("active"), new GUIContent("Active", "Enable Disable the Strafing Logic"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("SType"), new GUIContent("Use", "Use Camera or a Target to Calculate the Strafing"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("MainCamera"), new GUIContent("Main Camera", "Use the Main Camera for the Strafe Logic"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("Target"), new GUIContent("Target", "Use a Target for the Strafe Logic"));
            EditorGUILayout.EndVertical();


            //EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            //EditorGUILayout.PropertyField(serializedObject.FindProperty("Gravity"), new GUIContent("Gravity", "Gravity Direction"));
            //EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("Rotate"), new GUIContent("Rotate", "Add extra rotation while on Strafe Mode"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("SmoothValue"), new GUIContent("SmoothValue", "Smooth Value to the Rotation"));
            EditorGUILayout.EndVertical();


            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.PropertyField(updateAnimator, new GUIContent("Update Animator", "Update Animator with the Parameter"));

            if (M.UpdateAnimator)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_StrafeAngle"), new GUIContent("Param Name", "Name of the Parameter on The Animator for the Strafing"));
            }
            EditorGUILayout.EndVertical();


            EditorGUILayout.EndVertical();
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Strafe Inspector");
                // EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 9
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Use a Mode on the Animal Controller to create combo sequences  \nActivate the combos using Activate(int) or Activate_XXYY(int) XX(Branch) YY(Combo Index)");

            EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
            {
                EditorGUILayout.PropertyField(Branch, new GUIContent("Branch", "Current Branch ID for the Combo Sequence, if this value change then the combo will play different sequences"));

                MalbersEditor.DrawDebugIcon(debug);
                //  debug.boolValue = GUILayout.Toggle(debug.boolValue,new GUIContent("D","Debug"), EditorStyles.miniButton, GUILayout.Width(23));
            }
            EditorGUILayout.EndHorizontal();


            CombosReor.DoLayoutList();

            CombosReor.index = selectedCombo.intValue;
            int IndexCombo = CombosReor.index;

            if (IndexCombo != -1)
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    var combo = combos.GetArrayElementAtIndex(IndexCombo);

                    if (combo != null)
                    {
                        var name = combo.FindPropertyRelative("Name");
                        EditorGUILayout.LabelField(name.stringValue, EditorStyles.boldLabel);
                        var active             = combo.FindPropertyRelative("m_Active");
                        var OnComboFinished    = combo.FindPropertyRelative("OnComboFinished");
                        var OnComboInterrupted = combo.FindPropertyRelative("OnComboInterrupted");
                        EditorGUILayout.PropertyField(active, new GUIContent("Active", "is the Combo Active?"));
                        EditorGUILayout.HelpBox("Green Sequences are starters combos", MessageType.None);
                        EditorGUILayout.LabelField("Combo Sequence List", EditorStyles.boldLabel);
                        var sequence = combo.FindPropertyRelative("Sequence");
                        DrawSequence(IndexCombo, combo, sequence);
                        EditorGUILayout.PropertyField(OnComboFinished);
                        EditorGUILayout.PropertyField(OnComboInterrupted);
                    }
                }
                EditorGUILayout.EndVertical();
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 10
0
        public virtual void PaintInspectorGUI(string title)
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription(title);


            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    //EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("value"), new GUIContent("Value", "The current value"));
                    //var useEvent = serializedObject.FindProperty("UseEvent");
                    //useEvent.boolValue = GUILayout.Toggle(useEvent.boolValue, new GUIContent("E", "Enable 'OnValueChanged' Event. It will be invoked only when the value changes"), EditorStyles.miniButton, GUILayout.Width(18));
                    //EditorGUILayout.EndHorizontal();
                    // MalbersEditor.DrawSplitter();

                    // EditorGUILayout.EndVertical();

                    //  EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Description"));
                    //  EditorGUILayout.EndVertical();

                    // EditorGUILayout.BeginVertical(EditorStyles.helpBox);


                    //EditorGUILayout.PropertyField(useEvent, new GUIContent("Use Event", "If the value changes the On Value Changed Event will be invoked"));

                    //EditorGUI.BeginDisabledGroup(!useEvent.boolValue);

                    //if (useEvent.boolValue)
                    //{
                    //    MalbersEditor.DrawSplitter();
                    //    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnValueChanged"));
                    //}
                    // EditorGUILayout.EndVertical();
                    // EditorGUI.EndDisabledGroup();
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 11
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Receive Animations Events from the Animations Clips to play Sounds using the function (PlaySound (string Name))");

            EditorGUI.BeginChangeCheck();
            {
                EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
                {
                    list.DoLayoutList();

                    if (list.index != -1)
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            SerializedProperty Element = m_EventSound.GetArrayElementAtIndex(list.index);
                            EditorGUILayout.LabelField("►" + M.m_EventSound[list.index].name + "◄", EditorStyles.boldLabel);
                            EditorGUI.indentLevel++;
                            EditorGUILayout.PropertyField(Element.FindPropertyRelative("Clips"), new GUIContent("Clips", "AudioClips"), true);
                            EditorGUI.indentLevel--;
                        }
                        EditorGUILayout.EndVertical();
                    }

                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("_audioSource"), new GUIContent("Audio", "AudioSource"), true);
                        if (M._audioSource == null)
                        {
                            EditorGUILayout.HelpBox("If Audio is empty, this script will create an audiosource at runtime", MessageType.Info);
                        }
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Animation Event Sound");
                //  EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 12
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Receive Animations Events from the Animations Clips to play Sounds using the function (PlaySound (string Name))");

            EditorGUI.BeginChangeCheck();
            {
                EditorGUILayout.BeginVertical(MTools.StyleGray);
                {
                    list.DoLayoutList();

                    if (list.index != -1)
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            SerializedProperty Element = m_EventSound.GetArrayElementAtIndex(list.index);
                            EditorGUILayout.LabelField("[" + M.m_EventSound[list.index].name + "]", EditorStyles.boldLabel);
                            EditorGUI.indentLevel++;
                            EditorGUILayout.PropertyField(Element.FindPropertyRelative("interval"));
                            EditorGUILayout.PropertyField(Element.FindPropertyRelative("Clips"), new GUIContent("Clips", "AudioClips"), true);
                            EditorGUILayout.PropertyField(Element.FindPropertyRelative("source"), new GUIContent("Internal Source", "AudioSource"));
                            EditorGUI.indentLevel--;
                        }
                        EditorGUILayout.EndVertical();
                    }

                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("_audioSource"), new GUIContent("Global Source", "AudioSource"), true);
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Animation Event Sound");
                //  EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            MalbersEditor.DrawDescription("Reset Scriptable Variables");

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ResetOnEnable"), new GUIContent("Reset on Enable", "Reset the values when this Script is Enabled"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ResetOnDisable"), new GUIContent("Reset on Disable", "Reset the values when this Script is Disabled, and when the Play button is Off (in the Editor)"));
                    Reo_ScriptVars.DoLayoutList();
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 14
0
        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();
        }
Ejemplo n.º 15
0
        //private MStrafe M;

        // SerializedProperty updateAnimator, m_StrafeAngle, Target, MainCamera, SType, Normalize;

        //private void OnEnable()
        //{
        //    M = ((MStrafe)target);
        //    updateAnimator = serializedObject.FindProperty("UpdateAnimator");
        //    Normalize = serializedObject.FindProperty("Normalize");
        //    SType = serializedObject.FindProperty("SType");
        //    MainCamera = serializedObject.FindProperty("mainCamera");
        //    Target = serializedObject.FindProperty("target");
        //    m_StrafeAngle = serializedObject.FindProperty("m_StrafeAngle");
        //}


        public override void OnInspectorGUI()
        {
            MalbersEditor.DrawDescription("Strafing (Obsolete) Now its inside the Animal Controller");
            //serializedObject.Update();

            //MalbersEditor.DrawDescription("Strafing Logic");

            //EditorGUI.BeginChangeCheck();

            //EditorGUILayout.BeginVertical(MTools.StyleGray);


            //EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            //EditorGUILayout.PropertyField(SType, new GUIContent("Use", "Use Camera or a Target to Calculate the Strafing"));
            //EditorGUILayout.PropertyField(MainCamera, new GUIContent("Main Camera", "Use the Main Camera for the Strafe Logic"));
            //EditorGUILayout.PropertyField(Target, new GUIContent("Target", "Use a Target for the Strafe Logic"));
            //EditorGUILayout.EndVertical();


            //EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            //EditorGUILayout.PropertyField(updateAnimator, new GUIContent("Update Animator", "Update Animator with the Parameter"));

            //if (M.UpdateAnimator.Value)
            //{
            //    EditorGUILayout.PropertyField(Normalize, new GUIContent("Normalize", "Normalize the Angle Value. Instead of -180 to 180 it will go from -1 to 1"));
            //    EditorGUILayout.PropertyField(m_StrafeAngle, new GUIContent("Param Name", "Name of the Parameter on The Animator for the Strafing"));
            //}
            //EditorGUILayout.EndVertical();


            //EditorGUILayout.EndVertical();
            //if (EditorGUI.EndChangeCheck())
            //{
            //    Undo.RecordObject(target, "Strafe Inspector");
            //}

            //serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 16
0
        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();
        }
Ejemplo n.º 17
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Melee Weapons Properties");

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                CommonWeaponProperties();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.PropertyField(meleeCollider, new GUIContent("Melee Collider", "Gets the reference of where is the Melee Collider of this weapon (Not Always is in the same gameobject level)"));
                EditorGUILayout.EndVertical();

                SoundsList();

                EventList();

                CheckWeaponID();
            }
            EditorGUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 18
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Swap Materials");

            EditorGUI.BeginChangeCheck();
            {
                EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
                {
                    list.DoLayoutList();
                    EditorGUI.indentLevel++;

                    if (showMeshesList.boolValue)
                    {
                        if (list.index != -1)
                        {
                            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                            {
                                SerializedProperty Element = materialList.GetArrayElementAtIndex(list.index);
                                //if (Element.objectReferenceValue != null)
                                {
                                    EditorGUILayout.LabelField(Element.FindPropertyRelative("Name").stringValue, EditorStyles.boldLabel);

                                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                                    {
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("mesh"), new GUIContent("Mesh", "Mesh object to apply the Materials"));
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("indexM"), new GUIContent("ID", "Material ID"));
                                    }
                                    EditorGUILayout.EndVertical();

                                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                                    {
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("materials"), new GUIContent("Materials"), true);
                                    }
                                    EditorGUILayout.EndVertical();

                                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                                    {
                                        SerializedProperty hasLODS = Element.FindPropertyRelative("HasLODs");
                                        EditorGUILayout.PropertyField(hasLODS, new GUIContent("LODs", "Has Level of Detail Meshes"));
                                        if (hasLODS.boolValue)
                                        {
                                            EditorGUILayout.PropertyField(Element.FindPropertyRelative("LODs"), new GUIContent("Meshes", "Has Level of Detail Meshes"), true);
                                        }
                                    }
                                    EditorGUILayout.EndVertical();

                                    EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                                    {
                                        EditorGUIUtility.labelWidth = 65;
                                        var linked = Element.FindPropertyRelative("Linked");

                                        EditorGUILayout.PropertyField(linked, new GUIContent("Linked", "This Material Item will be driven by another Material Item"));
                                        if (linked.boolValue)
                                        {
                                            var Master = Element.FindPropertyRelative("Master");
                                            EditorGUILayout.PropertyField(Master, new GUIContent("Master", "Which MaterialItem Index is the Master"));

                                            if (Master.intValue >= materialList.arraySize)
                                            {
                                                Master.intValue = materialList.arraySize - 1;
                                            }
                                        }
                                        EditorGUIUtility.labelWidth = 0;
                                    }
                                    EditorGUILayout.EndHorizontal();

                                    EditorGUILayout.BeginVertical();
                                    {
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("OnMaterialChanged"), new GUIContent("On Material Changed", "Invoked when a material item index changes"));
                                    }
                                    EditorGUILayout.EndVertical();
                                }
                            }
                            EditorGUILayout.EndVertical();
                        }
                    }
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Material Changer");
            }
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 19
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Basic AI system for Animal Script");

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);

            MalbersEditor.DrawScript(script);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("target"), new GUIContent("Target", "Target to follow"));

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(stoppingDistance, new GUIContent("Stopping Distance", "Agent Stopping Distance"));
            EditorGUILayout.PropertyField(walkDistance, new GUIContent("Walk Distance", "Distance to stop Runing and Start Walking"));

            if (EditorGUI.EndChangeCheck())
            {
                if (M.Agent)
                {
                    M.Agent.stoppingDistance = stoppingDistance.floatValue;
                    serializedObject.ApplyModifiedProperties();
                }
            }

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUI.indentLevel++;
            M.showevents = EditorGUILayout.Foldout(M.showevents, "Events");
            EditorGUI.indentLevel--;



            if (M.showevents)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("OnTargetPositionArrived"), new GUIContent("On Position Arrived"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("OnTargetArrived"), new GUIContent("On Target Arrived"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("OnActionStart"), new GUIContent("On Action Start"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("OnActionEnd"), new GUIContent("On Action End"));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("OnDebug"), new GUIContent("On Debug"));
            }
            EditorGUILayout.EndVertical();


            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            var d = serializedObject.FindProperty("debug");

            EditorGUILayout.PropertyField(d);

            if (d.boolValue && Application.isPlaying)
            {
                EditorGUI.BeginDisabledGroup(true);
                EditorGUILayout.ObjectField("Next Target", M.NextTarget, typeof(Transform), false);
                EditorGUILayout.ObjectField("Next Target Zone?", M.IsZone, typeof(Zone), false);
                EditorGUILayout.ObjectField("Next Target WayPoint", M.IsWayPoint, typeof(MWayPoint), false);
                EditorGUILayout.Space();
                EditorGUILayout.FloatField("Remaining Distance", M.RemainingDistance);
                EditorGUILayout.Vector3Field("Target Position", M.TargetPosition);
                EditorGUILayout.ToggleLeft("Target is Moving?", M.TargetisMoving);
                EditorGUILayout.Space();
                EditorGUILayout.ToggleLeft("Is On Mode", M.IsOnMode);
                EditorGUILayout.ToggleLeft("Enter OffMesh", M.EnterOFFMESH);
                EditorGUILayout.ToggleLeft("Free Move", M.FreeMove);
                EditorGUILayout.ToggleLeft("Flying OffMesh", M.IsFlyingOffMesh);
                EditorGUILayout.ToggleLeft("Agent Active?", M.Agent.enabled);
                EditorGUILayout.ToggleLeft("Agent in NavMesh", M.Agent.isOnNavMesh);
                EditorGUILayout.ToggleLeft("Is Waiting?", M.IsWaiting);
                EditorGUILayout.ToggleLeft("Is Grounded?", M.IsGrounded);
                EditorGUI.EndDisabledGroup();
            }

            EditorGUILayout.EndVertical();

            if (!M.Agent)
            {
                EditorGUILayout.HelpBox("There's no Agent found on the hierarchy on this gameobject\nPlease add a NavMesh Agent Component", MessageType.Error);
            }


            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Animal AI Control Changed");
                //EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 20
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Events Listeners. They Response to the MEvents Assets\nThe MEvents should not repeat on the list");

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    list.DoLayoutList();

                    if (list.index != -1)
                    {
                        if (list.index < list.count)
                        {
                            SerializedProperty Element = eventsListeners.GetArrayElementAtIndex(list.index);

                            if (M.Events[list.index].Event != null)
                            {
                                string Descp = M.Events[list.index].Event.Description;

                                if (Descp != string.Empty)
                                {
                                    EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen);
                                    {
                                        EditorGUILayout.HelpBox(M.Events[list.index].Event.Description, MessageType.None);
                                    }
                                    EditorGUILayout.EndVertical();
                                }

                                EditorGUILayout.Space();

                                useFloat     = Element.FindPropertyRelative("useFloat");
                                useBool      = Element.FindPropertyRelative("useBool");
                                useInt       = Element.FindPropertyRelative("useInt");
                                useString    = Element.FindPropertyRelative("useString");
                                useVoid      = Element.FindPropertyRelative("useVoid");
                                useGo        = Element.FindPropertyRelative("useGO");
                                useTransform = Element.FindPropertyRelative("useTransform");
                                useComponent = Element.FindPropertyRelative("useComponent");
                                useVector3   = Element.FindPropertyRelative("useVector3");
                                useVector2   = Element.FindPropertyRelative("useVector2");
                                useSprite    = Element.FindPropertyRelative("useSprite");

                                EditorGUILayout.BeginHorizontal();
                                {
                                    useVoid.boolValue    = GUILayout.Toggle(useVoid.boolValue, new GUIContent("Void", "No Parameters Response"), EditorStyles.toolbarButton);
                                    useBool.boolValue    = GUILayout.Toggle(useBool.boolValue, new GUIContent("Bool", "Bool Response"), EditorStyles.toolbarButton);
                                    useFloat.boolValue   = GUILayout.Toggle(useFloat.boolValue, new GUIContent("Float", "Float Response"), EditorStyles.toolbarButton);
                                    useInt.boolValue     = GUILayout.Toggle(useInt.boolValue, new GUIContent("Int", "Int Response"), EditorStyles.toolbarButton);
                                    useString.boolValue  = GUILayout.Toggle(useString.boolValue, new GUIContent("String", "String Response"), EditorStyles.toolbarButton);
                                    useVector3.boolValue = GUILayout.Toggle(useVector3.boolValue, new GUIContent("V3", "Vector3 Response"), EditorStyles.toolbarButton);
                                    useVector2.boolValue = GUILayout.Toggle(useVector2.boolValue, new GUIContent("V2", "Vector3 Response"), EditorStyles.toolbarButton);
                                }
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                {
                                    useGo.boolValue        = GUILayout.Toggle(useGo.boolValue, new GUIContent("GameObject", "Game Object Response"), EditorStyles.toolbarButton);
                                    useTransform.boolValue = GUILayout.Toggle(useTransform.boolValue, new GUIContent("Transform", "Transform Response"), EditorStyles.toolbarButton);
                                    useComponent.boolValue = GUILayout.Toggle(useComponent.boolValue, new GUIContent("Component", "Component Response"), EditorStyles.toolbarButton);
                                    useSprite.boolValue    = GUILayout.Toggle(useSprite.boolValue, new GUIContent("Sprite", "Component Response"), EditorStyles.toolbarButton);
                                }
                                EditorGUILayout.EndHorizontal();

                                if (useVoid.boolValue)
                                {
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("Response"));
                                }

                                if (useBool.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    var useAdvBool = Element.FindPropertyRelative("AdvancedBool");
                                    // if (!useAdvBool.boolValue)
                                    {
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("InvertBool"));
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseBool"), new GUIContent("Response"));
                                    }
                                    useAdvBool.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Use Advanced Bool", "Uses Separated Unity Events for True and False Entries"), useAdvBool.boolValue);
                                    if (useAdvBool.boolValue)
                                    {
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseBoolTrue"), new GUIContent("On True"));
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseBoolFalse"), new GUIContent("On False"));
                                    }
                                }

                                if (useFloat.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseFloat"), new GUIContent("Response"));
                                }

                                if (useInt.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();

                                    var useAdvInteger = Element.FindPropertyRelative("AdvancedInteger");
                                    useAdvInteger.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Use Advanced Integer Comparer", "Compare the entry value with a default one to make a new Int Response "), useAdvInteger.boolValue);

                                    if (useAdvInteger.boolValue)
                                    {
                                        EditorGUILayout.Space();
                                        EditorGUI.indentLevel++;
                                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("IntEventList"), new GUIContent("Advanced Integer Comparer"), true);
                                        EditorGUILayout.EndVertical();
                                        EditorGUI.indentLevel--;
                                    }
                                    //   else
                                    {
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseInt"), new GUIContent("Response"));
                                    }
                                }

                                if (useString.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseString"), new GUIContent("Response"));
                                }
                                if (useGo.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseGO"), new GUIContent("Response GO"));
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseNull"), new GUIContent("Response NULL"));
                                }
                                if (useTransform.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseTransform"), new GUIContent("Response T"));
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseNull"), new GUIContent("Response NULL"));
                                }
                                if (useComponent.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseComponent"), new GUIContent("Response C"));
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseNull"), new GUIContent("Response NULL"));
                                }
                                if (useSprite.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseSprite"), new GUIContent("Response Sprite"));
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseNull"), new GUIContent("Response NULL"));
                                }

                                if (useVector3.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseVector3"), new GUIContent("Response V3"));
                                }
                                if (useVector2.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseVector2"), new GUIContent("Response V2"));
                                }
                            }
                        }
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 21
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Utility to align the Position and Rotation of an Target Object relative this one");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                //MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.BeginHorizontal();

                    AlignPos.boolValue = GUILayout.Toggle(AlignPos.boolValue, new GUIContent("Position", "Align Position"), EditorStyles.miniButton);
                    AlignRot.boolValue = GUILayout.Toggle(AlignRot.boolValue, new GUIContent("Rotation", "Align Rotation"), EditorStyles.miniButton);
                    if (AlignPos.boolValue || AlignRot.boolValue)
                    {
                        AlignLookAt.boolValue = false;
                    }

                    AlignLookAt.boolValue = GUILayout.Toggle(AlignLookAt.boolValue, new GUIContent("Look At", "Align a gameObject Looking at the Aligner"), EditorStyles.miniButton);


                    if (AlignLookAt.boolValue)
                    {
                        AlignPos.boolValue = AlignRot.boolValue = false;
                    }
                    EditorGUILayout.EndHorizontal();



                    if (AlignRot.boolValue || AlignPos.boolValue)
                    {
                        EditorGUILayout.PropertyField(DoubleSided, new GUIContent("Double Sided", "When Rotation is Enabled then It will find the closest Rotation"));
                    }

                    if (AlignLookAt.boolValue)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.PropertyField(LookAtRadius, new GUIContent("Radius", "The Target will move close to the Aligner equals to the Radius"));

                        EditorGUILayout.PropertyField(DebugColor, GUIContent.none, GUILayout.MaxWidth(40));
                        EditorGUILayout.EndHorizontal();

                        if (LookAtRadius.floatValue > 0)
                        {
                            EditorGUILayout.PropertyField(LookAtRadiusTime, new GUIContent("Look At Align Time", "Time to move The Target to the Aligner "));
                        }
                    }
                }
                EditorGUILayout.EndVertical();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(AlingPoint1, new GUIContent("Main Point", "The Target GameObject will move to the Position of the Align Point"));
                    EditorGUILayout.PropertyField(AlingPoint2, new GUIContent("2nd Point", "If Point End is Active then the Animal will align to the closed position from the 2 align points line"));
                }
                EditorGUILayout.EndVertical();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PropertyField(AlignTime, new GUIContent("Align Time", "Time needed to make the Aligment"));
                    EditorGUILayout.PropertyField(AlignCurve, GUIContent.none, GUILayout.MaxWidth(75));
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Aligner Inspector");
                EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 22
0
        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();
        }
Ejemplo n.º 23
0
        public override void OnInspectorGUI()
        {
            MalbersEditor.DrawDescription("Pick Up Logic for Pickable Items");
            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);
                serializedObject.Update();
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.PropertyField(PickUpArea);
                EditorGUILayout.PropertyField(PickUpLayer);
                EditorGUILayout.PropertyField(AutoPick);
                EditorGUILayout.EndVertical();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(Holder);
                    EditorGUILayout.LabelField("Offsets", EditorStyles.boldLabel);
                    EditorGUILayout.PropertyField(PosOffset, new GUIContent("Position", "Position Local Offset to parent the item to the holder"));
                    EditorGUILayout.PropertyField(RotOffset, new GUIContent("Rotation", "Rotation Local Offset to parent the item to the holder"));
                }
                EditorGUILayout.EndVertical();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(item);
                    EditorGUI.BeginDisabledGroup(true);
                    EditorGUILayout.PropertyField(FocusedItem);
                    EditorGUI.EndDisabledGroup();
                }
                EditorGUILayout.EndVertical();


                GUIStyle styles = new GUIStyle(EditorStyles.foldout);

                styles.fontStyle = FontStyle.Bold;

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUI.indentLevel++;
                    ShowEvents.boolValue = EditorGUILayout.Foldout(ShowEvents.boolValue, "Events", styles);
                    EditorGUI.indentLevel--;

                    if (ShowEvents.boolValue)
                    {
                        EditorGUILayout.PropertyField(CanPickUp);
                        EditorGUILayout.PropertyField(OnPicking);
                        EditorGUILayout.PropertyField(OnDropping);
                    }
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(DebugRadius);
                    EditorGUILayout.PropertyField(DebugColor, GUIContent.none, GUILayout.MaxWidth(40));
                }
                EditorGUILayout.EndHorizontal();

                serializedObject.ApplyModifiedProperties();
                EditorGUILayout.EndVertical();
            }
        }
Ejemplo n.º 24
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Look Decision for the AI Brain");

            EditorGUI.BeginChangeCheck();
            MalbersEditor.DrawScript(script);

            EditorGUILayout.PropertyField(Description);
            EditorGUILayout.PropertyField(MessageID);
            EditorGUILayout.PropertyField(send);
            EditorGUILayout.PropertyField(interval);
            EditorGUILayout.PropertyField(LookRange);
            EditorGUILayout.PropertyField(LookAngle);

            EditorGUILayout.PropertyField(lookFor);
            EditorGUILayout.PropertyField(ObstacleLayer);



            LookDecision.LookFor lookforval = (LookDecision.LookFor)lookFor.intValue;

            switch (lookforval)
            {
            case LookDecision.LookFor.AnimalPlayer:
                break;

            case LookDecision.LookFor.Tags:
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(tags, true);
                EditorGUI.indentLevel--;
                break;

            case LookDecision.LookFor.UnityTags:
                EditorGUILayout.PropertyField(UnityTag);
                break;

            case LookDecision.LookFor.Zones:
                EditorGUILayout.PropertyField(zoneType, new GUIContent("Zone Type", "Choose between a Mode or a State for the Zone"));
                EditorGUILayout.PropertyField(ZoneID);

                if (ZoneID.intValue < 1)
                {
                    EditorGUILayout.HelpBox("If ID is set to Zero, it will search for any " + ((ZoneType)zoneType.intValue).ToString() + " Zone.", MessageType.None);
                }

                if (zoneType.intValue == 0)
                {
                    EditorGUILayout.PropertyField(ZoneModeIndex);

                    if (ZoneModeIndex.intValue == -1)
                    {
                        EditorGUILayout.HelpBox("When [ID = -1], it will search for any " + ((ZoneType)zoneType.intValue).ToString() + " Zone", MessageType.None);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("It will search for a " + ((ZoneType)zoneType.intValue).ToString() + " Zone with the ID equals to " + ZoneModeIndex.intValue.ToString(), MessageType.None);
                    }
                }
                break;

            case LookDecision.LookFor.GameObject:
                EditorGUILayout.PropertyField(GameObjectName, new GUIContent("GameObject"));
                break;

            case LookDecision.LookFor.ClosestWayPoint:
                break;

            default:
                break;
            }



            EditorGUILayout.PropertyField(AssignTarget);
            EditorGUILayout.PropertyField(MoveToTarget);

            if (!AssignTarget.boolValue)
            {
                EditorGUILayout.PropertyField(RemoveTarget);
            }
            else
            {
                RemoveTarget.boolValue = false;
            }


            EditorGUILayout.PropertyField(debugColor);
            // EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Look Decision Inspector");
                EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 25
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Makes this GameObject mountable. Requires Mount Triggers and Moint Points");

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUI.BeginChangeCheck();
                {
                    Editor_Tabs1.intValue = GUILayout.Toolbar(Editor_Tabs1.intValue, new string[] { "General", "Links", "Custom Mount" });
                    if (Editor_Tabs1.intValue != 3)
                    {
                        Editor_Tabs2.intValue = 3;
                    }

                    Editor_Tabs2.intValue = GUILayout.Toolbar(Editor_Tabs2.intValue, new string[] { "M/D States", "Events", "Debug" });
                    if (Editor_Tabs2.intValue != 3)
                    {
                        Editor_Tabs1.intValue = 3;
                    }


                    //First Tabs
                    int Selection = Editor_Tabs1.intValue;

                    if (Selection == 0)
                    {
                        ShowGeneral();
                    }
                    else if (Selection == 1)
                    {
                        ShowLinks();
                    }
                    else if (Selection == 2)
                    {
                        ShowCustom();
                    }

                    //2nd Tabs
                    Selection = Editor_Tabs2.intValue;

                    if (Selection == 0)
                    {
                        ShowStates();
                    }
                    else if (Selection == 1)
                    {
                        ShowEvents();
                    }
                    else if (Selection == 2)
                    {
                        ShowDebug();
                    }
                }

                EditorGUILayout.EndVertical();


                if (M.MountPoint == null)
                {
                    EditorGUILayout.HelpBox("'Mount Point'  is empty, please set a reference", MessageType.Warning);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Mount Inspector");
                //EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 26
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Events Listeners. They Response to the MEvents Assets\nThe MEvents should not repeat on the list");

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    list.DoLayoutList();

                    if (list.index != -1)
                    {
                        if (list.index < list.count)
                        {
                            SerializedProperty Element = eventsListeners.GetArrayElementAtIndex(list.index);

                            if (M.Events[list.index].Event != null)
                            {
                                string Descp = M.Events[list.index].Event.Description;

                                if (Descp != string.Empty)
                                {
                                    EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen);
                                    {
                                        EditorGUILayout.HelpBox(M.Events[list.index].Event.Description, MessageType.None);
                                    }
                                    EditorGUILayout.EndVertical();
                                }

                                EditorGUILayout.Space();

                                useFloat     = Element.FindPropertyRelative("useFloat");
                                useBool      = Element.FindPropertyRelative("useBool");
                                useInt       = Element.FindPropertyRelative("useInt");
                                useString    = Element.FindPropertyRelative("useString");
                                useVoid      = Element.FindPropertyRelative("useVoid");
                                useGo        = Element.FindPropertyRelative("useGO");
                                useTransform = Element.FindPropertyRelative("useTransform");
                                useComponent = Element.FindPropertyRelative("useComponent");
                                useVector3   = Element.FindPropertyRelative("useVector3");
                                useVector2   = Element.FindPropertyRelative("useVector2");
                                useSprite    = Element.FindPropertyRelative("useSprite");

                                var TypeStyle = new GUIStyle(EditorStyles.objectField);


                                EditorGUILayout.BeginHorizontal();
                                {
                                    useVoid.boolValue    = GUILayout.Toggle(useVoid.boolValue, new GUIContent("Void", "No Parameters Response"), TypeStyle);
                                    useBool.boolValue    = GUILayout.Toggle(useBool.boolValue, new GUIContent("Bool", "Bool Response"), TypeStyle);
                                    useFloat.boolValue   = GUILayout.Toggle(useFloat.boolValue, new GUIContent("Float", "Float Response"), TypeStyle);
                                    useInt.boolValue     = GUILayout.Toggle(useInt.boolValue, new GUIContent("Int", "Int Response"), TypeStyle);
                                    useString.boolValue  = GUILayout.Toggle(useString.boolValue, new GUIContent("String", "String Response"), TypeStyle);
                                    useVector3.boolValue = GUILayout.Toggle(useVector3.boolValue, new GUIContent("V3", "Vector3 Response"), TypeStyle);
                                    useVector2.boolValue = GUILayout.Toggle(useVector2.boolValue, new GUIContent("V2", "Vector3 Response"), TypeStyle);
                                }
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                {
                                    useGo.boolValue        = GUILayout.Toggle(useGo.boolValue, new GUIContent("GameObject", "Game Object Response"), TypeStyle);
                                    useTransform.boolValue = GUILayout.Toggle(useTransform.boolValue, new GUIContent("Transform", "Transform Response"), TypeStyle);
                                    useComponent.boolValue = GUILayout.Toggle(useComponent.boolValue, new GUIContent("Component", "Component Response"), TypeStyle);
                                    useSprite.boolValue    = GUILayout.Toggle(useSprite.boolValue, new GUIContent("Sprite", "Sprite Response"), TypeStyle);
                                }
                                EditorGUILayout.EndHorizontal();

                                Draw_Void(Element);

                                Draw_Bool(Element);

                                Draw_Float(Element);

                                Draw_Integer(Element);

                                DrawString(Element);

                                Draw_GameObject(Element);

                                DrawTransform(Element);

                                DrawComponent(Element);

                                DrawSprite(Element);

                                DrawVector2(Element);

                                DrawVector3(Element);
                            }
                        }
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 27
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Attack Trigger Logic. By default should be Disabled.");

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(index);
                    EditorGUILayout.PropertyField(Trigger);
                    EditorGUILayout.PropertyField(PushForce);
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(hitLayer);
                    EditorGUILayout.PropertyField(triggerInteraction);
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.LabelField("Owner Stat", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(SelfStatEnter, true);
                    EditorGUILayout.PropertyField(SelfStatExit, true);
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.LabelField("Enemy Stat", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(EnemyStatEnter, true);
                    EditorGUILayout.PropertyField(EnemyStatExit, true);
                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(debug);
                    if (debug.boolValue)
                    {
                        EditorGUILayout.PropertyField(DebugColor, GUIContent.none);
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndVertical();
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Strafe Inspector");
                // EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 28
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Zone modify States, Stances or Modes on an Animal");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                //zoneType.intValue = (int)(ZoneType)EditorGUILayout.EnumPopup(new GUIContent("Zone Type", "Choose between a Mode or a State for the Zone"), (ZoneType)zoneType.intValue);
                EditorGUILayout.PropertyField(zoneType, new GUIContent("Zone Type", "Choose between a Mode or a State for the Zone"));

                ZoneType zone = (ZoneType)zoneType.intValue;


                switch (zone)
                {
                case ZoneType.Mode:
                    EditorGUILayout.PropertyField(modeID, new GUIContent("Mode ID", "Which Mode to Set when entering the Zone"));

                    serializedObject.ApplyModifiedProperties();


                    if (M.modeID != null && M.modeID == 4)
                    {
                        EditorGUILayout.PropertyField(ActionID, new GUIContent("Action Index", "Which Action to Set when entering the Zone"));

                        if (ActionID.objectReferenceValue == null)
                        {
                            EditorGUILayout.HelpBox("Please Select an Action ID", MessageType.Error);
                        }
                    }
                    else
                    {
                        EditorGUILayout.PropertyField(modeIndex, new GUIContent("Ability Index", "Which Ability to Set when entering the Zone"));
                        if (ActionID.objectReferenceValue == null)
                        {
                            EditorGUILayout.HelpBox("Please Select an Ability ID", MessageType.Error);
                        }
                    }

                    EditorGUILayout.PropertyField(ModeFloat);
                    EditorGUILayout.PropertyField(auto, new GUIContent("Automatic", "As soon as the animal enters the zone play the action"));
                    if (auto.boolValue)
                    {
                        EditorGUILayout.PropertyField(AutomaticDisabled, new GUIContent("Disabled", "if true the Trigger will be disabled for this value in seconds"));
                        if (AutomaticDisabled.floatValue < 0)
                        {
                            AutomaticDisabled.floatValue = 0;
                        }
                    }
                    break;

                case ZoneType.State:
                    EditorGUILayout.PropertyField(stateID, new GUIContent("State ID", "Which State will Activate when entering the Zone"));
                    EditorGUILayout.PropertyField(stateAction, new GUIContent("Action", "Set what action for State the animal will apply when entering the zone"));
                    if (stateID.objectReferenceValue == null)
                    {
                        EditorGUILayout.HelpBox("Please Select an State ID", MessageType.Error);
                    }
                    break;

                case ZoneType.Stance:
                    EditorGUILayout.PropertyField(stanceID, new GUIContent("Stance ID", "Which Stance will Activate when entering the Zone"));
                    EditorGUILayout.PropertyField(stanceAction, new GUIContent("Action", "Set what action for stance the animal will apply when entering the zone"));
                    if (stanceID.objectReferenceValue == null)
                    {
                        EditorGUILayout.HelpBox("Please Select an Stance ID", MessageType.Error);
                    }
                    break;

                case ZoneType.Force:
                    EditorGUILayout.PropertyField(Force);
                    EditorGUILayout.PropertyField(EnterAceleration);
                    EditorGUILayout.PropertyField(ExitAceleration);
                    EditorGUILayout.PropertyField(Bounce);
                    break;

                default:
                    break;
                }



                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    if (zone != ZoneType.Force)
                    {
                        EditorGUILayout.PropertyField(RemoveAnimalOnActive, new GUIContent("Remove Animal on Active", "Remove the Stored Animal on the Zone when the zones get's Active"));
                    }
                    EditorGUILayout.PropertyField(m_tag, new GUIContent("Tag", "Set this parameter if you want the zone to Interact only with gameObject with that tag"));
                    EditorGUILayout.PropertyField(HeadOnly, new GUIContent("Head Only", "Activate when the Head Bone the Zone.\nThe Head Bone needs a collider and be Named Head"));
                    if (HeadOnly.boolValue)
                    {
                        EditorGUILayout.PropertyField(HeadName, new GUIContent("Head Name", "Name for the Head Bone"));
                    }
                }
                EditorGUILayout.EndVertical();


                if (zone == ZoneType.Mode)
                {
                }


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUI.indentLevel++;
                    ShowStatModifiers.boolValue = EditorGUILayout.Foldout(ShowStatModifiers.boolValue, "Stat Modifiers");

                    if (ShowStatModifiers.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(StatModifierOnEnter, new GUIContent("On Enter", "Modify the Stat entering the Zone"), true);
                        EditorGUILayout.PropertyField(StatModifierOnExit, new GUIContent("On Exit", "Modify the Stat exiting the Zone"), true);
                        EditorGUILayout.PropertyField(statModifier, new GUIContent("On Active", "Modify the Stat when the Zone is Active"), true);
                        EditorGUI.indentLevel--;
                    }
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndVertical();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUI.indentLevel++;
                M.EditorShowEvents = EditorGUILayout.Foldout(M.EditorShowEvents, "Events");
                EditorGUI.indentLevel--;

                if (M.EditorShowEvents)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnEnter"), new GUIContent("On Animal Enter"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnExit"), new GUIContent("On Animal Exit"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnZoneActivation"), new GUIContent("On Zone Active"));
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Zone Inspector");
                EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 29
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Zone Activate |States| or |Modes| on an Animal");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                //zoneType.intValue = (int)(ZoneType)EditorGUILayout.EnumPopup(new GUIContent("Zone Type", "Choose between a Mode or a State for the Zone"), (ZoneType)zoneType.intValue);
                EditorGUILayout.PropertyField(zoneType, new GUIContent("Zone Type", "Choose between a Mode or a State for the Zone"));

                ZoneType zone = (ZoneType)zoneType.intValue;


                switch (zone)
                {
                case ZoneType.Mode:
                    EditorGUILayout.PropertyField(modeID, new GUIContent("Mode ID", "Which Mode to Set when entering the Zone"));

                    serializedObject.ApplyModifiedProperties();


                    if (M.modeID != null && M.modeID == 4)
                    {
                        EditorGUILayout.PropertyField(ActionID, new GUIContent("Action ID", "Which Action to Set when entering the Zone"));

                        if (ActionID.objectReferenceValue == null)
                        {
                            EditorGUILayout.HelpBox("Please Select an Action ID", MessageType.Error);
                        }
                    }
                    else
                    {
                        EditorGUILayout.PropertyField(ID, new GUIContent("Ability ID", "Which Ability to Set when entering the Zone"));
                        if (ActionID.objectReferenceValue == null)
                        {
                            EditorGUILayout.HelpBox("Please Select an Ability ID", MessageType.Error);
                        }
                    }
                    break;

                case ZoneType.State:
                    EditorGUILayout.PropertyField(stateID, new GUIContent("State ID", "Which State will Activate when entering the Zone"));
                    if (stateID.objectReferenceValue == null)
                    {
                        EditorGUILayout.HelpBox("Please Select an State ID", MessageType.Error);
                    }
                    break;

                case ZoneType.Stance:
                    EditorGUILayout.PropertyField(stanceID, new GUIContent("Stance ID", "Which Stance will Activate when entering the Zone"));
                    if (stanceID.objectReferenceValue == null)
                    {
                        EditorGUILayout.HelpBox("Please Select an Stance ID", MessageType.Error);
                    }
                    break;

                default:
                    break;
                }



                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(HeadOnly, new GUIContent("Head Only", "Activate when the Head Bone the Zone.\nThe Head Bone needs a collider and be Named Head"));
                    if (HeadOnly.boolValue)
                    {
                        EditorGUILayout.PropertyField(HeadName, new GUIContent("Head Name", "Name for the Head Bone"));
                    }
                }
                EditorGUILayout.EndVertical();

                if (zone == ZoneType.Mode)
                {
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(auto, new GUIContent("Automatic", "As soon as the animal enters the zone play the action"));

                        if (auto.boolValue)
                        {
                            EditorGUILayout.PropertyField(AutomaticDisabled, new GUIContent("Disabled", "if true the Trigger will be disabled for this value in seconds"));

                            if (AutomaticDisabled.floatValue < 0)
                            {
                                AutomaticDisabled.floatValue = 0;
                            }
                        }
                    }
                    EditorGUILayout.EndVertical();
                }

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.BeginHorizontal();

                    var aling = serializedObject.FindProperty("Align");
                    EditorGUILayout.PropertyField(aling, new GUIContent("Align", "Aligns the Animal to the Align Position and Rotation of the AlignPoint"));

                    if (aling.boolValue)
                    {
                        AlignPos.boolValue = GUILayout.Toggle(AlignPos.boolValue, new GUIContent("P", "Align Position"), EditorStyles.miniButton, GUILayout.MaxWidth(25));
                        AlignRot.boolValue = GUILayout.Toggle(AlignRot.boolValue, new GUIContent("R", "Align Rotation"), EditorStyles.miniButton, GUILayout.MaxWidth(25));

                        if (M.AlignPos || M.AlignRot)
                        {
                            M.AlignLookAt = false;
                        }

                        AlignLookAt.boolValue = GUILayout.Toggle(AlignLookAt.boolValue, new GUIContent("L", "Align Looking at the Zone"), EditorStyles.miniButton, GUILayout.MaxWidth(25));

                        if (AlignLookAt.boolValue)
                        {
                            AlignPos.boolValue = AlignRot.boolValue = false;
                        }
                    }

                    if (AlingPoint.objectReferenceValue == null)
                    {
                        AlingPoint.objectReferenceValue = M.transform;
                    }
                    serializedObject.ApplyModifiedProperties();


                    EditorGUILayout.EndHorizontal();

                    if (aling.boolValue)
                    {
                        if (AlignRot.boolValue || AlignPos.boolValue)
                        {
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("DoubleSided"), new GUIContent("Double Sided", "When Rotation is Enabled then It will find the closest Rotation"));
                        }
                        EditorGUILayout.PropertyField(AlingPoint, new GUIContent("Aling Point", "the Animal will move to the Position of the Align Point"));
                        EditorGUILayout.PropertyField(AlingPoint2, new GUIContent("Aling Point End", "If Point End is Active then the Animal will align to the closed position from the 2 align points line"));
                        EditorGUILayout.PropertyField(AlignTime, new GUIContent("Align Time", "Time to aling"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("AlignCurve"), new GUIContent("Align Curve"));

                        if (AlignTime.floatValue < 0)
                        {
                            AlignTime.floatValue = 0;
                        }
                    }
                }
                EditorGUILayout.EndVertical();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(StatModifier, true);
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndVertical();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUI.indentLevel++;
                M.EditorShowEvents = EditorGUILayout.Foldout(M.EditorShowEvents, "Events");
                EditorGUI.indentLevel--;

                if (M.EditorShowEvents)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnEnter"), new GUIContent("On Animal Enter"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnExit"), new GUIContent("On Animal Exit"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnZoneActivation"), new GUIContent("On Zone Active"));
                }
                EditorGUILayout.EndVertical();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUI.indentLevel++;
                M.EditorAI = EditorGUILayout.Foldout(M.EditorAI, "AI");
                if (M.EditorAI)
                {
                    EditorGUI.indentLevel--;
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("stoppingDistance"), new GUIContent("Stopping Distance"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("waitTime"), new GUIContent("Wait Time", "Wait Time after the Action ended"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("pointType"), new GUIContent("Zone Type", "Which type is this action zone"));
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("nextTargets"), new GUIContent("Next Targets", "Posible Targets to go after finishing the Action"), true);
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.EndVertical();

                //      base.OnInspectorGUI();
            }
            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Zone Inspector");
                EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 30
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Zone Activate |States| or |Modes| on an Animal");

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                //zoneType.intValue = (int)(ZoneType)EditorGUILayout.EnumPopup(new GUIContent("Zone Type", "Choose between a Mode or a State for the Zone"), (ZoneType)zoneType.intValue);
                EditorGUILayout.PropertyField(zoneType, new GUIContent("Zone Type", "Choose between a Mode or a State for the Zone"));

                ZoneType zone = (ZoneType)zoneType.intValue;


                switch (zone)
                {
                case ZoneType.Mode:
                    EditorGUILayout.PropertyField(modeID, new GUIContent("Mode ID", "Which Mode to Set when entering the Zone"));

                    serializedObject.ApplyModifiedProperties();


                    if (M.modeID != null && M.modeID == 4)
                    {
                        EditorGUILayout.PropertyField(ActionID, new GUIContent("Action ID", "Which Action to Set when entering the Zone"));

                        if (ActionID.objectReferenceValue == null)
                        {
                            EditorGUILayout.HelpBox("Please Select an Action ID", MessageType.Error);
                        }
                    }
                    else
                    {
                        EditorGUILayout.PropertyField(ID, new GUIContent("Ability ID", "Which Ability to Set when entering the Zone"));
                        if (ActionID.objectReferenceValue == null)
                        {
                            EditorGUILayout.HelpBox("Please Select an Ability ID", MessageType.Error);
                        }
                    }
                    break;

                case ZoneType.State:
                    EditorGUILayout.PropertyField(stateID, new GUIContent("State ID", "Which State will Activate when entering the Zone"));
                    EditorGUILayout.PropertyField(stateAction, new GUIContent("Action", "Set what action for State the animal will apply when entering the zone"));
                    if (stateID.objectReferenceValue == null)
                    {
                        EditorGUILayout.HelpBox("Please Select an State ID", MessageType.Error);
                    }
                    break;

                case ZoneType.Stance:
                    EditorGUILayout.PropertyField(stanceID, new GUIContent("Stance ID", "Which Stance will Activate when entering the Zone"));
                    EditorGUILayout.PropertyField(stanceAction, new GUIContent("Action", "Set what action for stance the animal will apply when entering the zone"));
                    if (stanceID.objectReferenceValue == null)
                    {
                        EditorGUILayout.HelpBox("Please Select an Stance ID", MessageType.Error);
                    }
                    break;

                default:
                    break;
                }



                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(HeadOnly, new GUIContent("Head Only", "Activate when the Head Bone the Zone.\nThe Head Bone needs a collider and be Named Head"));
                    if (HeadOnly.boolValue)
                    {
                        EditorGUILayout.PropertyField(HeadName, new GUIContent("Head Name", "Name for the Head Bone"));
                    }
                }
                EditorGUILayout.EndVertical();

                if (zone == ZoneType.Mode)
                {
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(auto, new GUIContent("Automatic", "As soon as the animal enters the zone play the action"));

                        if (auto.boolValue)
                        {
                            EditorGUILayout.PropertyField(AutomaticDisabled, new GUIContent("Disabled", "if true the Trigger will be disabled for this value in seconds"));

                            if (AutomaticDisabled.floatValue < 0)
                            {
                                AutomaticDisabled.floatValue = 0;
                            }
                        }
                    }
                    EditorGUILayout.EndVertical();
                }


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(statModifier, true);
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndVertical();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUI.indentLevel++;
                M.EditorShowEvents = EditorGUILayout.Foldout(M.EditorShowEvents, "Events");
                EditorGUI.indentLevel--;

                if (M.EditorShowEvents)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnEnter"), new GUIContent("On Animal Enter"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnExit"), new GUIContent("On Animal Exit"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OnZoneActivation"), new GUIContent("On Zone Active"));
                }
                EditorGUILayout.EndVertical();


                //EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                //EditorGUI.indentLevel++;
                //M.EditorAI = EditorGUILayout.Foldout(M.EditorAI, "AI");
                //if (M.EditorAI)
                //{
                //    EditorGUI.indentLevel--;
                //    EditorGUILayout.PropertyField(serializedObject.FindProperty("stoppingDistance"), new GUIContent("Stopping Distance"));
                //    EditorGUILayout.PropertyField(serializedObject.FindProperty("waitTime"), new GUIContent("Wait Time", "Wait Time after the Action ended"));
                //    EditorGUILayout.PropertyField(serializedObject.FindProperty("pointType"), new GUIContent("Zone Type", "Which type is this action zone"));
                //    EditorGUI.indentLevel++;
                //    EditorGUILayout.PropertyField(serializedObject.FindProperty("nextTargets"), new GUIContent("Next Targets", "Posible Targets to go after finishing the Action"), true);
                //    EditorGUI.indentLevel--;
                //}
                //EditorGUI.indentLevel--;
                //EditorGUILayout.EndVertical();

                //      base.OnInspectorGUI();
            }
            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Zone Inspector");
                EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();
        }