예제 #1
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();
        }
예제 #2
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();
        }
예제 #3
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();
        }
예제 #4
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();
        }
예제 #5
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();
        }
        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();
        }
예제 #7
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();
        }
예제 #8
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            MalbersEditor.DrawDescription("AI Movement Logic for the Animal");

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

                MalbersEditor.DrawScript(script);

                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();
        }
예제 #9
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();
        }
예제 #10
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();


            MalbersEditor.DrawDescription("All the selector actions and animations are managed here");

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

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    M.FocusedItemIndex = EditorGUILayout.IntField(new GUIContent("Focused Item", "Index of the first Item to appear on Focus (Zero Index Based)"), M.FocusedItemIndex);

                    if (M.FocusedItemIndex == -1)
                    {
                        EditorGUILayout.HelpBox("-1 Means no item is selected", MessageType.Info);
                    }
                    if (M.FocusedItemIndex < -1)
                    {
                        M.FocusedItemIndex = -1;
                    }

                    EditorGUILayout.PropertyField(RestoreTime, new GUIContent("Restore Time", "Time to restore the previuous item to his original position"));
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginHorizontal();
                {
                    AnimateSelection.boolValue = GUILayout.Toggle(AnimateSelection.boolValue, new GUIContent("Animate Selection", "Animate the selection between items"), EditorStyles.toolbarButton);
                    SoloSelection.boolValue    = !AnimateSelection.boolValue;

                    SoloSelection.boolValue    = GUILayout.Toggle(SoloSelection.boolValue, new GUIContent("Solo Selection", "Animate the selection between items"), EditorStyles.toolbarButton);
                    AnimateSelection.boolValue = !SoloSelection.boolValue;
                }
                EditorGUILayout.EndHorizontal();

                if (AnimateSelection.boolValue)
                {
                    EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen);
                    EditorGUILayout.HelpBox("The Selector Controller will move and rotate to center the selected Item", MessageType.None);
                    EditorGUILayout.EndVertical();


                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(SelectionTime, new GUIContent("Selection Time", "Time between the selection among the objects"));

                        if (SelectionTime.floatValue < 0)
                        {
                            SelectionTime.floatValue = 0;                               //Don't put time below zero;
                        }
                        if (SelectionTime.floatValue != 0)
                        {
                            EditorGUILayout.PropertyField(SelectionCurve, new GUIContent("Selection Curve", "Timing of the selection animation"));
                        }


                        EditorGUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.PropertyField(DragSpeed, new GUIContent("Drag Speed", "Swipe speed when swiping  :)"));
                            if (DragSpeed.floatValue != 0)
                            {
                                dragHorizontal.boolValue = GUILayout.Toggle(dragHorizontal.boolValue, new GUIContent(dragHorizontal.boolValue ? "Horizontal" : "Vertical", "Drag/Swipe type from the mouse/touchpad "), EditorStyles.popup);
                            }
                        }
                        EditorGUILayout.EndHorizontal();
                        if (DragSpeed.floatValue == 0)
                        {
                            EditorGUILayout.HelpBox("Drag is disabled", MessageType.Info);
                        }
                    }
                    EditorGUILayout.EndVertical();

                    if (DragSpeed.floatValue != 0)
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                        EditorGUILayout.PropertyField(inertia, new GUIContent("Inertia", "Add inertia when Draging is enabled and the mouse is released"));

                        if (inertia.boolValue)
                        {
                            EditorGUILayout.PropertyField(inertiaTime, new GUIContent("Inertia Time", "The time on inertia when the Drag is released"));
                            EditorGUILayout.PropertyField(minInertiaSpeed, new GUIContent("Inertia Min Speed", "Min Speed to apply inertia"));
                            EditorGUILayout.PropertyField(inertiaCurve, new GUIContent("Inertia Curve", "the Curve for the time inertia"));
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        EditorGUILayout.PropertyField(UseSelectionZone, new GUIContent("Use Selection Zone", "Add inertia when Draging is enabled and the mouse is released"));

                        if (UseSelectionZone.boolValue)
                        {
                            EditorGUI.BeginChangeCheck();

                            EditorGUILayout.PropertyField(serializedObject.FindProperty("ZMinX"), new GUIContent("Min X", "Region enableed for the Dragging/Swapping"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("ZMaxX"), new GUIContent("Max X", "Region enableed for the Dragging/Swapping"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("ZMinY"), new GUIContent("Min Y", "Region enableed for the Dragging/Swapping"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("ZMaxY"), new GUIContent("Max Y", "Region enableed for the Dragging/Swapping"));
                        }
                        EditorGUILayout.EndVertical();
                    }
                }

                if (SoloSelection.boolValue)
                {
                    EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen);
                    EditorGUILayout.HelpBox("The Selector Controller will not move", MessageType.None);
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    EditorGUILayout.PropertyField(Hover, new GUIContent("Hover Selection", "Select by hovering the mouse over an item"));
                    EditorGUILayout.EndVertical();
                }


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                EditorGUI.indentLevel++;
                EditorIdleAnims.boolValue = EditorGUILayout.Foldout(EditorIdleAnims.boolValue, "Idle Animations");
                EditorGUI.indentLevel--;

                if (EditorIdleAnims.boolValue)
                {
                    EditorGUILayout.BeginHorizontal();
                    MoveIdle.boolValue   = GUILayout.Toggle(MoveIdle.boolValue, new GUIContent("Move", "Repeating moving motion for the focused item"), EditorStyles.miniButton);
                    RotateIdle.boolValue = GUILayout.Toggle(RotateIdle.boolValue, new GUIContent("Rotate", "Turning table for the focused item"), EditorStyles.miniButton);
                    ScaleIdle.boolValue  = GUILayout.Toggle(ScaleIdle.boolValue, new GUIContent("Scale", "Repeating scale motion for the focused item"), EditorStyles.miniButton);
                    EditorGUILayout.EndHorizontal();

                    if (MoveIdle.boolValue)
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        EditorGUILayout.PropertyField(MoveIdleAnim, new GUIContent("Move Idle", "Idle Move Animation when is on focus"));
                        EditorGUILayout.EndVertical();
                    }
                    if (M.RotateIdle)
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        EditorGUILayout.PropertyField(ItemRotationSpeed, new GUIContent("Speed", "How fast the focused Item will rotate"));
                        EditorGUILayout.PropertyField(TurnTableVector, new GUIContent("Rotation Vector", "Choose your desire vector to rotate around"));
                        EditorGUILayout.EndVertical();
                    }

                    if (M.ScaleIdle)
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        EditorGUILayout.PropertyField(ScaleIdleAnim, new GUIContent("Scale Idle", "Idle Scale Animation when is on focus"));
                        EditorGUILayout.EndVertical();
                    }
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.PropertyField(LockMaterial, new GUIContent("Lock Material", "Material choosed for the locked objects"));

                EditorGUILayout.BeginHorizontal();
                EditorGUIUtility.labelWidth = 95;

                if (E && E.SelectorCamera)
                {
                    EditorGUILayout.PropertyField(frame_Camera, new GUIContent("Frame Camera", " Auto Adjust the camera position by the size of the object"), GUILayout.MinWidth(20));
                    if (frame_Camera.boolValue)
                    {
                        EditorGUIUtility.labelWidth = 55;
                        EditorGUILayout.PropertyField(frame_Multiplier, new GUIContent("Multiplier", "Distance Mupltiplier for the camera frame"), GUILayout.MaxWidth(100));
                    }
                }
                EditorGUIUtility.labelWidth = 0;
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUI.indentLevel++;
                EditorInput.boolValue = EditorGUILayout.Foldout(EditorInput.boolValue, "Inputs");
                EditorGUI.indentLevel--;

                if (EditorInput.boolValue)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Submit"), new GUIContent("Submit"));

                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ChangeLeft"), new GUIContent("Change Left"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ChangeRight"), new GUIContent("Change Right"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ChangeUp"), new GUIContent("Change Up"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ChangeDown"), new GUIContent("Change Down"));
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUI.indentLevel++;
                EditorAdvanced.boolValue = EditorGUILayout.Foldout(EditorAdvanced.boolValue, "Advanced");

                if (EditorAdvanced.boolValue)
                {
                    if (!Hover.boolValue)
                    {
                        EditorGUILayout.PropertyField(ClickToFocus, new GUIContent("Click to Focus", "If a another item is touched/clicked, focus on it"));
                    }

                    EditorGUILayout.PropertyField(ChangeOnEmptySpace, new GUIContent("Change on Empty Space", "If there's a Click/Touch on an empty space change to the next/previous item"));
                    EditorGUILayout.PropertyField(Threshold, new GUIContent("Threshold", "Max Threshold to identify if is a click/touch or a drag/swipe"));
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.EndVertical();

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

                if (EditorShowEvents.boolValue)
                {
                    EditorGUILayout.PropertyField(OnClickOnItem, new GUIContent("On Click/Touch an Item"));
                    EditorGUILayout.PropertyField(OnItemFocused, new GUIContent("On Item Focused"));
                    if (AnimateSelection.boolValue)
                    {
                        EditorGUILayout.PropertyField(OnIsChangingItem, new GUIContent("Is Changing Item"));
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();


            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Selector Controller Inspector");
                //EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }
예제 #11
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();
        }
예제 #12
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();
        }
예제 #13
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.BeginVertical(MalbersEditor.StyleBlue);
            EditorGUILayout.HelpBox("Manage the distribution of all Items\nItems are always child of this gameObject", MessageType.None);
            EditorGUILayout.EndVertical();

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

            MalbersEditor.DrawScript(script);


            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(SelectorCamera, new GUIContent("Selector Camera", "Camera for the selector"));
            if (EditorGUI.EndChangeCheck())
            {
                AddRaycaster();
            }



            if (SelectorCamera.objectReferenceValue != null)
            {
                EditorGUILayout.PropertyField(WorldCamera, new GUIContent("World Spacing", "The camera is no longer child of the Selector\nIt should be child of the Main Camera, Use this when the the Selector on the hands of a character, on VR mode, etc"));

                if (!WorldCamera.boolValue)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(CameraOffset, new GUIContent("Offset", "Camera Forward Offset"));
                    EditorGUILayout.PropertyField(CameraPosition, new GUIContent("Position", "Camera Position Offset"));
                    EditorGUILayout.PropertyField(CameraRotation, new GUIContent("Rotation", "Camera Rotation Offset"));
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RecordObject(target, "Change Camera Values");
                        M.SetCamera();
                        EditorUtility.SetDirty(target);
                    }
                }
            }

            if (M.transform.childCount != M.Items.Count)
            {
                M.UpdateItemsList();
                EditorUtility.SetDirty(target);
            }

            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(SelectorType1, new GUIContent("Selector Type", "Items Distribution"));

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(ItemRendererType, new GUIContent("Items Type", "Items Renderer Type"));
            if (EditorGUI.EndChangeCheck())
            {
                AddRaycaster();
            }

            EditorGUILayout.EndVertical();
            GUIContent DistanceName = new GUIContent("Radius", "Radius of the selector");

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);

            var selType = (SelectorType)SelectorType1.enumValueIndex;

            switch (selType)
            {
            case SelectorType.Radial:
                EditorGUILayout.PropertyField(distance, DistanceName);
                EditorGUILayout.PropertyField(RadialAxis, new GUIContent("Axis", "Radial Axis"));
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(UseWorld, new GUIContent("Use World Rotation", "The Items will keep the same initial Rotation"));
                EditorGUILayout.PropertyField(LookRotation, new GUIContent("Use Look Rotation", "The items will look to the center of the selector"));
                EditorGUILayout.EndHorizontal();
                break;

            case SelectorType.Linear:
                DistanceName           = new GUIContent("Distance", "Distance between objects");
                LookRotation.boolValue = false;
                //  EditorUtility.SetDirty(target);
                serializedObject.ApplyModifiedProperties();
                EditorGUILayout.PropertyField(distance, DistanceName);
                LinearX.floatValue = EditorGUILayout.Slider(new GUIContent("Linear X"), LinearX.floatValue, -1, 1);
                LinearY.floatValue = EditorGUILayout.Slider(new GUIContent("Linear Y"), LinearY.floatValue, -1, 1);
                LinearZ.floatValue = EditorGUILayout.Slider(new GUIContent("Linear Z"), LinearZ.floatValue, -1, 1);
                UseWorld.boolValue = false;
                break;

            case SelectorType.Grid:
                UseWorld.boolValue = false;
                EditorGUILayout.BeginHorizontal();
                EditorGUIUtility.labelWidth = 65;
                EditorGUILayout.PropertyField(Grid, new GUIContent("Columns", "Ammount of the Columns for the Grid. the Rows are given my the ammount of Items"), GUILayout.MinWidth(100));
                EditorGUIUtility.labelWidth = 15;
                EditorGUILayout.PropertyField(GridWidth, new GUIContent("W", "Width"), GUILayout.MinWidth(50));
                EditorGUILayout.PropertyField(GridHeight, new GUIContent("H", "Height"), GUILayout.MinWidth(50));
                EditorGUIUtility.labelWidth = 0;
                EditorGUILayout.EndHorizontal();
                break;

            case SelectorType.Custom:

                if (GUILayout.Button(new GUIContent("Store Item Location", "Store the Initial Pos/Rot/Scale of every Item")))
                {
                    M.StoreCustomLocation();
                }
                break;

            default:
                break;
            }

            EditorGUILayout.PropertyField(RotationOffSet, new GUIContent("Rotation Offset", "Offset for the Rotation on the Radial Selector"));
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Editor Selector Changed");
                M.LinearVector = new Vector3(M.LinearX, M.LinearY, M.LinearZ);  //Set the new linear vector

                if (M.SelectorType == SelectorType.Custom)
                {
                    if (EditorUtility.DisplayDialog("Use Current Distribution", "Do you want to save the current distribution as a Custom Type Selector", "Yes", "No"))
                    {
                        M.StoreCustomLocation();
                    }
                }

                M.ItemsLocation();
                EditorUtility.SetDirty(target);
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUI.indentLevel++;
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(Items, new GUIContent("Items"), true);
            EditorGUI.EndDisabledGroup();
            EditorGUI.indentLevel--;
            EditorGUILayout.EndVertical();
            GUILayout.BeginHorizontal();

            GUILayout.EndHorizontal();


            EditorGUILayout.EndVertical();


            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(target, "Editor Values Changed");
                // EditorUtility.SetDirty(target);
            }

            serializedObject.ApplyModifiedProperties();
        }
예제 #14
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();
            }
        }
예제 #15
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Data values to save on each Selector");

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

                EditorGUILayout.PropertyField(usePlayerPref);
                EditorGUILayout.PropertyField(PlayerPrefKey);
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                GUIStyle newGuiStyle = new GUIStyle(EditorStyles.label)
                {
                    alignment = TextAnchor.MiddleCenter,
                    fontStyle = FontStyle.Bold
                };

                EditorGUILayout.PropertyField(FocusedItem);
                EditorGUILayout.BeginHorizontal();
                UseMaterialChanger.boolValue = GUILayout.Toggle(UseMaterialChanger.boolValue, new GUIContent("Material Changer", "The items on the selector have the Material Changer component"), EditorStyles.miniButton);
                UseActiveMesh.boolValue      = GUILayout.Toggle(UseActiveMesh.boolValue, new GUIContent("Active Mesh", "The items on the selector have the Active Mesh component"), EditorStyles.miniButton);
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();


                //-----------------

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.LabelField("Coins", newGuiStyle);
                    EditorGUILayout.BeginVertical(EditorStyles.textField); EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginHorizontal();
                    EditorGUI.indentLevel++;
                    EditorGUIUtility.labelWidth = 75;
                    EditorGUILayout.PropertyField(Coins, new GUIContent("Current"), GUILayout.MinWidth(30));
                    EditorGUILayout.PropertyField(RestoreCoins, new GUIContent("Restore"), GUILayout.MinWidth(30));
                    EditorGUIUtility.labelWidth = 0;
                    EditorGUI.indentLevel--;
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();

                //-----------------

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.LabelField("Locked", newGuiStyle);
                    EditorGUILayout.BeginVertical(EditorStyles.textField); EditorGUILayout.EndVertical();
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(Locked, new GUIContent("Current"), true);
                    EditorGUILayout.PropertyField(RestoreLocked, new GUIContent("Restore"), true);
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndVertical();


                //---------------------------------------------------------------------------------

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.LabelField("Items Amount", newGuiStyle);
                    EditorGUILayout.BeginVertical(EditorStyles.textField); EditorGUILayout.EndVertical();
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(ItemsAmount, new GUIContent("Current"), true);
                    EditorGUILayout.PropertyField(RestoreItemsAmount, new GUIContent("Restore"), true);
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.EndVertical();

                //---------------------------------------------------------------------------------

                if (UseMaterialChanger.boolValue)
                {
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.LabelField("Material Changer Index", newGuiStyle);
                        EditorGUILayout.BeginVertical(EditorStyles.textField); EditorGUILayout.EndVertical();
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(Save.FindPropertyRelative("MaterialIndex"), new GUIContent("Current"), true);
                        EditorGUILayout.PropertyField(Save.FindPropertyRelative("RestoreMaterialIndex"), new GUIContent("Restore"), true);
                        EditorGUI.indentLevel--;
                    }
                    EditorGUILayout.EndVertical();
                }

                //---------------------------------------------------------------------------------

                if (UseActiveMesh.boolValue)
                {
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.LabelField("Active Meshes Index", newGuiStyle);
                        EditorGUILayout.BeginVertical(EditorStyles.textField); EditorGUILayout.EndVertical();
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(ActiveMeshIndex, new GUIContent("Current"), true);
                        EditorGUILayout.PropertyField(RestoreActiveMeshIndex, new GUIContent("Restore"), true);
                        EditorGUI.indentLevel--;
                    }
                    EditorGUILayout.EndVertical();
                }
            }

            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Selector Data Inspector");
                //EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }
예제 #16
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Manage all the Effects using the function (PlayEffect(int ID))");

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

                    list.DoLayoutList();

                    if (list.index != -1)
                    {
                        Effect effect = M.Effects[list.index];

                        SerializedProperty Element = EffectList.GetArrayElementAtIndex(list.index);

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUILayout.LabelField("* " + effect.Name + " *", EditorStyles.boldLabel);
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUI.indentLevel++;
                            general = EditorGUILayout.Foldout(general, "General");
                            EditorGUI.indentLevel--;

                            if (general)
                            {
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("effect"), new GUIContent("Effect", "The Prefab or gameobject which holds the Effect(Particles, transforms)"));


                                if (effect.effect != null)
                                {
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("life"), new GUIContent("Life", "Duration of the Effect. The Effect will be destroyed after the Life time has passed"));
                                }

                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("delay"), new GUIContent("Delay", "Time before playing the Effect"));

                                if (Element.FindPropertyRelative("life").floatValue <= 0)
                                {
                                    EditorGUILayout.HelpBox("Life = 0  the effect will not be destroyed by this Script", MessageType.Info);
                                }
                            }
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUI.indentLevel++;
                            parent = EditorGUILayout.Foldout(parent, "Parent");
                            EditorGUI.indentLevel--;
                            if (parent)
                            {
                                SerializedProperty root = Element.FindPropertyRelative("root");
                                EditorGUILayout.PropertyField(root, new GUIContent("Root", "Uses the Root transform to position the Effect"));

                                if (root.objectReferenceValue != null)
                                {
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("isChild"), new GUIContent("is Child", "Set the Effect as a child of the Root transform"));
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("useRootRotation"), new GUIContent("Use Root Rotation", "Orient the Effect using the root rotation."));
                                }
                            }
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUI.indentLevel++;
                            offsets = EditorGUILayout.Foldout(offsets, "Offsets");
                            EditorGUI.indentLevel--;
                            if (offsets)
                            {
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("PositionOffset"), new GUIContent("Position", "Add additional offset to the Effect rotation"));
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("RotationOffset"), new GUIContent("Rotation", "Add additional offset to the Effect position"));
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("ScaleMultiplier"), new GUIContent("Scale", "Add additional offset to the Effect Scale"));
                            }
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUILayout.PropertyField(Element.FindPropertyRelative("Modifier"), new GUIContent("Modifier", ""));

                            if (effect.Modifier != null && effect.Modifier.Description != string.Empty)
                            {
                                SerializedObject modifier = new SerializedObject(effect.Modifier);
                                var property = modifier.GetIterator();

                                property.NextVisible(true);                 //Don't Paint the first "Base thing"
                                property.NextVisible(true);                 //Don't Paint the script
                                property.NextVisible(true);                 //Don't Paint the Description I already painted

                                EditorGUILayout.HelpBox(effect.Modifier.Description, MessageType.None);

                                EditorGUI.BeginChangeCheck();
                                {
                                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                                    {
                                        do
                                        {
                                            EditorGUILayout.PropertyField(property, true);
                                        } while (property.NextVisible(false));
                                    }
                                    EditorGUILayout.EndVertical();
                                }
                                if (EditorGUI.EndChangeCheck())
                                {
                                    Undo.RecordObject(effect.Modifier, "Ability Changed");
                                    modifier.ApplyModifiedProperties();
                                    if (modifier != null)
                                    {
                                        EditorUtility.SetDirty(effect.Modifier);
                                    }
                                }
                            }
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUI.indentLevel++;
                            eventss = EditorGUILayout.Foldout(eventss, "Events");
                            EditorGUI.indentLevel--;
                            if (eventss)
                            {
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("OnPlay"), new GUIContent("On Play"));
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("OnStop"), new GUIContent("On Stop"));
                            }
                        }
                        EditorGUILayout.EndVertical();
                    }
                }
                EditorGUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Effect Manager");
                //  EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }
예제 #17
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Save/Load Bones Transormations into a Preset");

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

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(preset);

                    bool disable_ = preset.objectReferenceValue == null;

                    EditorGUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button("New Preset"))
                        {
                            string newBonePath = EditorUtility.SaveFilePanelInProject("Create New Bone Preset", "new bone preset", "asset", "Message");

                            BonePreset bonePreset = CreateInstance <BonePreset>();

                            AssetDatabase.CreateAsset(bonePreset, newBonePath);

                            preset.objectReferenceValue = bonePreset;

                            EditorUtility.SetDirty(target);
                            Debug.Log("New Bone Preset Created");
                        }

                        EditorGUI.BeginDisabledGroup(disable_);
                        {
                            if (GUILayout.Button("Save"))
                            {
                                M.SavePreset();
                            }
                            if (GUILayout.Button("Load"))
                            {
                                M.LoadPreset();
                            }
                        }
                        EditorGUI.EndDisabledGroup();
                    }
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.LabelField("Bones (" + M.Bones.Count.ToString() + ")");
                    EditorGUI.BeginChangeCheck();
                    {
                        EditorGUILayout.PropertyField(Root);
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RecordObject(target, "Root Changed");
                        EditorUtility.SetDirty(M);
                        serializedObject.ApplyModifiedProperties();
                        M.SetBones();
                    }

                    MalbersEditor.Arrays(serializedObject.FindProperty("Filter"), new GUIContent("Filter|Not Include bones with names|"));
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    MalbersEditor.Arrays(serializedObject.FindProperty("Bones"));
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }
예제 #18
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Align Utility to Adjust the Position and Rotation of an Target Object relative to another");

            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();
                    }
                }
                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();
        }
예제 #19
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Movement Task for the AI Brain");

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

            EditorGUILayout.PropertyField(Description);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(MessageID);
            EditorGUILayout.PropertyField(debugColor, GUIContent.none, GUILayout.MaxWidth(40));
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(interval);

            MoveStopTask.MoveType taskk = (MoveStopTask.MoveType)task.intValue;

            string Help = GetTaskType(taskk);

            EditorGUILayout.PropertyField(task, new GUIContent("Task", Help));

            switch (taskk)
            {
            case MoveStopTask.MoveType.MoveToTarget:
                EditorGUILayout.PropertyField(LookAtTarget, new GUIContent("Look at Target", "If we Arrived to the Target then Keep Looking At it"));
                break;

            case MoveStopTask.MoveType.StopAnimal:
                break;

            case MoveStopTask.MoveType.StopAgent:
                break;

            case MoveStopTask.MoveType.RotateInPlace:
                break;

            case MoveStopTask.MoveType.Flee:
                EditorGUILayout.PropertyField(distance, new GUIContent("Distance", "Flee Safe Distance away from the Target"));
                EditorGUILayout.PropertyField(stoppingDistance, new GUIContent("Stop Distance", "Stopping Distance of the Flee point"));
                EditorGUILayout.PropertyField(UpdateFleeMovingTarget, new GUIContent("Moving Target", "If The target is moving: Update the Fleeing Point"));
                break;

            case MoveStopTask.MoveType.CircleAround:
                EditorGUILayout.PropertyField(distance, new GUIContent("Distance", "Flee Safe Distance away from the Target"));
                EditorGUILayout.PropertyField(stoppingDistance, new GUIContent("Stop Distance", "Stopping Distance of the Circle Around Points"));
                EditorGUILayout.PropertyField(Direction, new GUIContent("Direction", "Direction to Circle around the Target... left or right"));
                EditorGUILayout.PropertyField(arcsCount, new GUIContent("Arc Count", "Amount of Point to Form a Circle around the Target"));
                break;

            case MoveStopTask.MoveType.KeepDistance:
                EditorGUILayout.PropertyField(distance);
                EditorGUILayout.PropertyField(stoppingDistance);
                EditorGUILayout.PropertyField(distanceThreshold);
                break;

            default:
                break;
            }



            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen);
            EditorGUILayout.HelpBox(taskk.ToString() + ":\n\n" + Help, MessageType.None);
            EditorGUILayout.EndVertical();

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

            serializedObject.ApplyModifiedProperties();
        }
예제 #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");

                                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();
        }
예제 #21
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();
        }
예제 #22
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();
        }
예제 #23
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();
        }
예제 #24
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();
        }
예제 #25
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();
        }
예제 #26
0
        public override void OnInspectorGUI()
        {
            MalbersEditor.DrawDescription("Pickable Item");
            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);
                serializedObject.Update();
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.PropertyField(m_collider);
                EditorGUI.BeginDisabledGroup(true);
                EditorGUILayout.ToggleLeft("Is Picked", m.IsPicked);
                EditorGUI.EndDisabledGroup();

                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                EditorGUIUtility.labelWidth = 60;
                EditorGUILayout.PropertyField(IntID, new GUIContent("ID", "Int value the Pickable Item can store.. that it can be use for anything"));
                EditorGUILayout.PropertyField(FloatID, new GUIContent("Value", "Float value the Pickable Item can store.. that it can be use for anything"));
                EditorGUIUtility.labelWidth = 0;
                EditorGUILayout.EndHorizontal();


                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(PickAnimations, new GUIContent("Pick Up Animations", "Use Pick Up Animation to pick this item"));

                    if (PickAnimations.boolValue)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUIUtility.labelWidth = 60;
                        EditorGUILayout.PropertyField(PickUpMode, new GUIContent("Mode", "Mode that has the Pick Up animation"), GUILayout.MinWidth(170));
                        EditorGUIUtility.labelWidth = 40;
                        EditorGUILayout.PropertyField(PickUpAbility, new GUIContent("Ability", "Ability ID for the  Pick Up animation"), GUILayout.MinWidth(50));
                        EditorGUIUtility.labelWidth = 0;
                        EditorGUILayout.EndHorizontal();
                    }
                }
                EditorGUILayout.EndVertical();

                if (PickAnimations.boolValue)
                {
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    EditorGUILayout.PropertyField(Align, new GUIContent("Align", "Align the Animal to the Item"));

                    if (Align.boolValue)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUIUtility.labelWidth = 60;
                        EditorGUILayout.PropertyField(AlignDistance, new GUIContent("Distance", "Distance to move the Animal towards the Item"));
                        EditorGUIUtility.labelWidth = 40;
                        EditorGUILayout.PropertyField(AlignTime, new GUIContent("Time", "Time needed to do the Alignment"));
                        EditorGUIUtility.labelWidth = 0;
                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUILayout.EndVertical();
                }



                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(DropAnimations, new GUIContent("Drop Animations ", "Use Pick Up Animation to pick this item"));

                    if (PickAnimations.boolValue)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUIUtility.labelWidth = 60;
                        EditorGUILayout.PropertyField(DropMode, new GUIContent("Mode", "Mode that has the Pick Up animation"), GUILayout.MinWidth(170));
                        EditorGUIUtility.labelWidth = 40;
                        EditorGUILayout.PropertyField(DropAbility, new GUIContent("Ability", "Ability ID for the  Pick Up animation"), GUILayout.MinWidth(20));
                        EditorGUIUtility.labelWidth = 0;
                        EditorGUILayout.EndHorizontal();
                    }
                }
                EditorGUILayout.EndVertical();


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

                    if (ShowEvents.boolValue)
                    {
                        EditorGUILayout.PropertyField(OnFocused);
                        EditorGUILayout.PropertyField(OnPicked);
                        EditorGUILayout.PropertyField(OnDropped);
                    }
                }
                EditorGUILayout.EndVertical();

                serializedObject.ApplyModifiedProperties();
                EditorGUILayout.EndVertical();
            }
        }
예제 #27
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Swap Materials");

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

                    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();
        }
예제 #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();
        }
예제 #29
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();
        }
예제 #30
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Items Properties used on the Selector Editor & Controller");

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

                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUI.BeginDisabledGroup(true);
                        EditorGUILayout.TextField("Name", M.name, EditorStyles.label);
                        EditorGUI.EndDisabledGroup();
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("description"), new GUIContent("Description"));
                    }
                    EditorGUILayout.EndVertical();

                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("value"), new GUIContent("Value", "How many COINS is this item worth"), GUILayout.MinWidth(50));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("amount"), new GUIContent("Amount", "How many of these items are"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("locked"), new GUIContent("Locked", "True if this item is locked"));
                    }
                    EditorGUILayout.EndVertical();

                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("originalItem"), new GUIContent("Original Item", "The Object you want to instantiate when is selected"));
                    }
                    EditorGUILayout.EndVertical();

                    if (M.GetComponentInChildren <Animator>())
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("CustomAnimation"), new GUIContent("Custom Animation", "Plays an specific animation when the PlayAnimation is called"));
                        }
                        EditorGUILayout.EndVertical();
                    }


                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            EditorGUI.indentLevel++;
                            M.EditorShowEvents = EditorGUILayout.Foldout(M.EditorShowEvents, "Events");
                            EventHelp          = GUILayout.Toggle(EventHelp, "?", EditorStyles.miniButton, GUILayout.MaxWidth(16));
                            EditorGUI.indentLevel--;
                        }
                        EditorGUILayout.EndHorizontal();

                        if (M.EditorShowEvents)
                        {
                            if (EventHelp)
                            {
                                EditorGUILayout.HelpBox("On Selected: Invoked when an Item is selected using the method: 'SelectItem()'\n\n On Focused: Invoked when the item is focused(Highlighted)\n\nOn Locked: Invoked when the item is Locked \n\nOn Unlocked: Invoked when the item is unlocked(purchased) \n\nOn Ammount Changed: Invoked if the quantity of item has changed", MessageType.None);
                            }

                            EditorGUILayout.PropertyField(serializedObject.FindProperty("OnSelected"), new GUIContent("On Selected"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("OnFocused"), new GUIContent("On Focused"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("OnLocked"), new GUIContent("On Locked"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("OnUnlocked"), new GUIContent("On Unlocked"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("OnAmountChanged"), new GUIContent("On Amount Changed"));
                        }
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "MItem Input Inspector");
                //EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }