Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

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

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

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

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

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

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

            MalbersEditor.DrawDescription("Mobile Joystick Logic");


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

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    if (MalbersEditor.Foldout(AxisEditor, "Axis Properties"))
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            MalbersEditor.BoolButton(invertX, new GUIContent("Invert X"));
                            MalbersEditor.BoolButton(invertY, new GUIContent("Invert Y"));
                            MalbersEditor.BoolButton(Relative, new GUIContent("Drag"));
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.PropertyField(deathpoint);
                        EditorGUILayout.PropertyField(sensitivityX);
                        EditorGUILayout.PropertyField(sensitivityY);
                    }
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    if (MalbersEditor.Foldout(ReferencesEditor, "References"))
                    {
                        EditorGUILayout.PropertyField(axisValue);
                        EditorGUILayout.PropertyField(pressed);
                    }
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EventsEditor.boolValue = MalbersEditor.Foldout(EventsEditor, "Events");

                    if (EventsEditor.boolValue)
                    {
                        EditorGUILayout.PropertyField(OnJoystickDown);
                        EditorGUILayout.PropertyField(OnJoystickUp);
                        EditorGUILayout.PropertyField(OnJoystickPressed);
                        EditorGUILayout.Space();
                        EditorGUILayout.PropertyField(OnAxisChange);
                        EditorGUILayout.PropertyField(OnXAxisChange);
                        EditorGUILayout.PropertyField(OnYAxisChange);
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Inputs for conecting with Scripts");

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

                EditorGUI.BeginChangeCheck();
                {
#if REWIRED
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("PlayerID"), new GUIContent("Player ID", "Rewired Player ID"));
                    EditorGUILayout.EndVertical();
#endif

                    list.DoLayoutList();

                    var Index = list.index;

                    if (Index != -1)
                    {
                        SerializedProperty Element = inputs.GetArrayElementAtIndex(Index);
                        DrawInputEvents(Element, Index);
                    }

                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUI.indentLevel++;
                        showInputEvents.boolValue = EditorGUILayout.Foldout(showInputEvents.boolValue, "Events (Enable/Disable Malbers Input)");
                        EditorGUI.indentLevel--;

                        if (showInputEvents.boolValue)
                        {
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("OnInputEnabled"));
                            EditorGUILayout.PropertyField(serializedObject.FindProperty("OnInputDisabled"));
                        }
                    }
                    EditorGUILayout.EndVertical();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(target, "MInput Inspector");
                }
                serializedObject.ApplyModifiedProperties();
            }
            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Connects the INPUTS to the Controller System");

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

                    DrawRewired();

                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(Horizontal, new GUIContent("Horizontal", "Axis for the Horizontal Movement"));
                        EditorGUILayout.PropertyField(Vertical, new GUIContent("Vertical", "Axis for the Forward/Backward Movement"));

                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.PropertyField(UpDown, new GUIContent("UpDown", "Axis for the Up and Down Movement"));

                        if (GUILayout.Button(new GUIContent("Create", "Creates 'UpDown' on the Input Manager"), GUILayout.Width(55)))
                        {
                            CreateInputAxe();
                        }

                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUILayout.EndVertical();

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



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

            MalbersEditor.DrawDescription("Inputs for conecting with Scripts");

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

                EditorGUI.BeginChangeCheck();
                {
                    EditorGUILayout.PropertyField(IgnoreOnPause);
                    DrawRewired();
                    DrawListAnEvents();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(target, "MInput Inspector");
                }
                serializedObject.ApplyModifiedProperties();
            }
            EditorGUILayout.EndVertical();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Connects the INPUTS to the Locomotion System. The 'Name' is actually the Properties to access");

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

                EditorGUI.BeginChangeCheck();
#if REWIRED
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("PlayerID"), new GUIContent("Player ID", "Rewired Player ID"));
                EditorGUILayout.EndVertical();
#endif

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Horizontal"), new GUIContent("Horizontal", "Axis for the Horizontal Movement"));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Vertical"), new GUIContent("Vertical", "Axis for the Forward/Backward Movement"));

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("UpDown"), new GUIContent("UpDown", "Axis for the Up and Down Movement"));
                    if (GUILayout.Button(new GUIContent("Create", "Creates 'UpDown' on the Input Manager"), GUILayout.Width(50)))
                    {
                        CreateInputAxe();
                    }
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();

                list.DoLayoutList();
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("alwaysForward"), new GUIContent("Always Forward", "The Character will move forward forever"));
                }
                EditorGUILayout.EndVertical();

                var Index = list.index;

                if (Index != -1)
                {
                    SerializedProperty Element = inputs.GetArrayElementAtIndex(Index);
                    DrawInputEvents(Element, Index);
                }

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EditorGUI.indentLevel++;
                    M.showInputEvents = EditorGUILayout.Foldout(M.showInputEvents, "Events (Enable/Disable Malbers Input)");
                    EditorGUI.indentLevel--;

                    if (M.showInputEvents)
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("OnInputEnabled"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("OnInputDisabled"));
                    }
                }
                EditorGUILayout.EndVertical();


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



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

            MalbersEditor.DrawDescription("Dismember Limbs... To enable it, call the public methods for 'Dismember'");

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

                    list.DoLayoutList();


                    if (list.index != -1 && M.bodyParts.Count > list.index)
                    {
                        BodyPart           item    = M.bodyParts[list.index];
                        SerializedProperty Element = LimbList.GetArrayElementAtIndex(list.index);

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUILayout.BeginHorizontal();
                            {
                                EditorGUIUtility.labelWidth = 20;

                                EditorGUILayout.LabelField(item.name, EditorStyles.boldLabel);
                                EditorGUIUtility.labelWidth = 0;

                                EditorGUI.BeginDisabledGroup(true);
                                item.dismembered = GUILayout.Toggle(item.dismembered, new GUIContent(!item.dismembered ? "Not Used" : "Used", "This variable gets enabled when the limb is intantiated... that way the dismembering will be used one time"), EditorStyles.miniButton);
                                EditorGUI.EndDisabledGroup();

                                if (M.bodyParts[list.index].member != null)
                                {
                                    item.Instantiate = GUILayout.Toggle(item.Instantiate, new GUIContent("Instantiate", "if True the separated limb will be instantiated... else is already on scene and it will be enabled"), EditorStyles.miniButton);
                                }
                            }
                            EditorGUILayout.EndHorizontal();

                            Limb member = M.bodyParts[list.index].member;

                            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                            {
                                EditorGUILayout.PropertyField(Element.FindPropertyRelative("AttachedLimb"), new GUIContent("Attached Limb", "The Attached limb on the Animal.. this gameobject will be hide after is dismemered"), true);
                                if (member != null) //If theres a member on it
                                {
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("life"), new GUIContent("Destroy Limb", "Seconds before destroy the limb object"), true);
                                    if (Element.FindPropertyRelative("life").floatValue <= 0)
                                    {
                                        EditorGUILayout.HelpBox("Life <= 0 , the limb wont be destroy", MessageType.Warning);
                                    }
                                }
                            }
                            EditorGUILayout.EndVertical();



                            if (member != null) //If theres a member on it
                            {
                                EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen);
                                EditorGUILayout.HelpBox("[Attached Bones] Bones on the animal \n[Dismember Bones] Bones on the Detached Limb\n\n The order of elements of both List must match", MessageType.None);
                                EditorGUILayout.EndVertical();


                                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                                MalbersEditor.Arrays(Element.FindPropertyRelative("AttachedLimbBones"), new GUIContent("Attached Bones", "Attached Limb Bones... They are use for alinging the Dismembered bones"));
                                EditorGUILayout.EndVertical();


                                MemberScript = new SerializedObject(member);


                                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                                {
                                    EditorGUI.BeginDisabledGroup(true);
                                    MalbersEditor.Arrays(MemberScript.FindProperty("Bones"), new GUIContent("Dismember Bones", "The bones has to be on the same order than the Attached bones on the Dismember Script"));
                                    EditorGUI.EndDisabledGroup();
                                }
                                EditorGUILayout.EndVertical();
                            }
                            EditorGUILayout.PropertyField(Element.FindPropertyRelative("OnDismember"), new GUIContent("On Dismember", "Invoked when Dismember is called"), true);
                        }
                        EditorGUILayout.EndVertical();
                    }
                }

                if (changer)
                {
                    EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen);
                    {
                        EditorGUILayout.HelpBox("This animal has [MaterialChanger] component.\nSet a Material-Item name to match the materials on the Dismembered Limbs ", MessageType.None);
                    }
                    EditorGUILayout.EndVertical();


                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("MaterialItemName"), new GUIContent("Material-Item", "The Current Material Item on the Animal to Update the Limbs Material Items"));
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndVertical();
            }

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Dismember ChangeChanged");
                //EditorUtility.SetDirty(target);
            }

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

            MalbersEditor.DrawDescription("Notifies the Animator Asociate Scripts\nWorks exactly like Animation Events");


            EditorGUI.BeginChangeCheck();

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

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                EditorGUI.indentLevel++;
                if (listOnEnter.count > 0)
                {
                    OnEnter = true;
                }
                OnEnter = EditorGUILayout.Foldout(OnEnter, "On Enter (" + listOnEnter.count + ")");
                EditorGUI.indentLevel--;

                if (OnEnter)
                {
                    listOnEnter.DoLayoutList();
                }

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUI.indentLevel++;
                if (listOnExit.count > 0)
                {
                    OnExit = true;
                }
                OnExit = EditorGUILayout.Foldout(OnExit, "On Exit (" + listOnExit.count + ")");
                EditorGUI.indentLevel--;

                if (OnExit)
                {
                    listOnExit.DoLayoutList();
                }

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                EditorGUI.indentLevel++;
                if (listOnTime.count > 0)
                {
                    OnTime = true;
                }
                OnTime = EditorGUILayout.Foldout(OnTime, "On Time (" + listOnTime.count + ")");
                EditorGUI.indentLevel--;

                if (OnTime)
                {
                    listOnTime.DoLayoutList();
                }

                EditorGUILayout.EndVertical();
                EditorGUILayout.PropertyField(UseSendMessage, new GUIContent("Use Send Message", "Uses the SendMessage() instead"));
                EditorGUILayout.PropertyField(NormalizeTime, new GUIContent("NomalizeState", "Update State Time will be normalized "));
                EditorGUILayout.PropertyField(debug);
            }

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

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

            MalbersEditor.DrawDescription("Stats Manager");

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

                    if (Application.isPlaying)
                    {
                        EditorGUI.BeginDisabledGroup(true);
                        {
                            if (M.PinnedStat != null)
                            {
                                EditorGUILayout.ObjectField("Pin Stat: ", (StatID)M.PinnedStat.ID, typeof(StatID), false);
                            }
                            else
                            {
                                EditorGUILayout.LabelField("Pin Stat: NULL ");
                            }
                        }
                        EditorGUI.EndDisabledGroup();
                    }

                    list.DoLayoutList();

                    if (list.index != -1)
                    {
                        var element = statList.GetArrayElementAtIndex(list.index);
                        var id      = element.FindPropertyRelative("ID");
                        //  var name = element.FindPropertyRelative("name").stringValue;
                        var ShowEvents = element.FindPropertyRelative("ShowEvents");
                        var BelowValue = element.FindPropertyRelative("Below");
                        var AboveValue = element.FindPropertyRelative("Above");

                        var Value    = element.FindPropertyRelative("value");
                        var MaxValue = element.FindPropertyRelative("maxValue");
                        var MinValue = element.FindPropertyRelative("minValue");

                        var resetTo    = element.FindPropertyRelative("resetTo");
                        var InmuneTime = element.FindPropertyRelative("InmuneTime");

                        var Regenerate    = element.FindPropertyRelative("regenerate");
                        var RegenRate     = element.FindPropertyRelative("RegenRate");
                        var RegenWaitTime = element.FindPropertyRelative("RegenWaitTime");

                        var Degenerate    = element.FindPropertyRelative("degenerate");
                        var DegenRate     = element.FindPropertyRelative("DegenRate");
                        var DegenWaitTime = element.FindPropertyRelative("DegenWaitTime");
                        var multiplier    = element.FindPropertyRelative("multiplier");


                        EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                        {
                            EditorGUIUtility.labelWidth = 60;
                            EditorGUILayout.PropertyField(Value, new GUIContent("Value", "Current Value of the Stat"));
                            EditorGUILayout.PropertyField(multiplier, new GUIContent("Mult", "Stat Multiplier to be used when the value is modified"));
                            EditorGUIUtility.labelWidth = 0;
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                        {
                            EditorGUIUtility.labelWidth = 55;
                            EditorGUILayout.PropertyField(MinValue, new GUIContent("Min", "Minimun value of the Stat"));
                            EditorGUILayout.PropertyField(MaxValue, new GUIContent("Max", "Maximum value of the Stat"));
                            EditorGUIUtility.labelWidth = 0;
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUILayout.PropertyField(Regenerate, new GUIContent("Regenerate", "Can the Stat Regenerate over time?"));
                            EditorGUILayout.PropertyField(RegenRate, new GUIContent("Rate", "Regeneration Rate, how fast/Slow the Stat will regenerate"));
                            EditorGUILayout.PropertyField(RegenWaitTime, new GUIContent("Wait Time", "After the Stat is modified, the time to wait to start regenerating"));
                        }
                        EditorGUILayout.EndVertical();


                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUILayout.PropertyField(Degenerate, new GUIContent("Degenerate", "Can the Stat Degenerate over time?"));
                            EditorGUILayout.PropertyField(DegenRate, new GUIContent("Rate", "Degeneration Rate, how fast/Slow the Stat will Degenerate"));
                            EditorGUILayout.PropertyField(DegenWaitTime, new GUIContent("Wait Time", "After the Stat is modified, the time to wait to start degenerating"));
                        }
                        EditorGUILayout.EndVertical();

                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUILayout.PropertyField(resetTo, new GUIContent("Reset To", "When called the Funtion RESET()  it will reset to the Min Value or the Max Value"));
                            EditorGUILayout.PropertyField(InmuneTime, new GUIContent("Inmune Time", "If greater than zero, the Stat cannot be modify until the inmune time have passed"));

                            if (Application.isPlaying)
                            {
                                EditorGUI.BeginDisabledGroup(true);
                                EditorGUILayout.Toggle("Is Inmune", M.stats[list.index].IsInmune);
                                EditorGUI.EndDisabledGroup();
                            }
                        }
                        EditorGUILayout.EndVertical();


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

                            if (ShowEvents.boolValue)
                            {
                                string name = "Stat";

                                if (id.objectReferenceValue != null)
                                {
                                    name = id.objectReferenceValue.name;
                                }

                                EditorGUILayout.PropertyField(element.FindPropertyRelative("OnValueChange"), new GUIContent("On " + name + " change"));
                                EditorGUILayout.PropertyField(element.FindPropertyRelative("OnValueChangeNormalized"), new GUIContent("On " + name + " change normalized"));
                                MalbersEditor.DrawSplitter();
                                EditorGUILayout.Space();
                                EditorGUILayout.PropertyField(element.FindPropertyRelative("OnStatFull"), new GUIContent("On " + name + " full "));
                                EditorGUILayout.PropertyField(element.FindPropertyRelative("OnStatEmpty"), new GUIContent("On " + name + " empty "));
                                EditorGUILayout.PropertyField(element.FindPropertyRelative("OnDegenereate"), new GUIContent("On " + name + " degenerate "));

                                MalbersEditor.DrawSplitter();
                                EditorGUILayout.Space();
                                EditorGUILayout.BeginHorizontal();
                                {
                                    EditorGUIUtility.labelWidth = 55;
                                    EditorGUILayout.PropertyField(BelowValue, new GUIContent("Below", "Used to Check when the Stat is below this value"));
                                    EditorGUILayout.PropertyField(AboveValue, new GUIContent("Above", "Used to Check when the Stat is Above this value"));
                                    EditorGUIUtility.labelWidth = 0;
                                }
                                EditorGUILayout.EndHorizontal();
                                EditorGUILayout.PropertyField(element.FindPropertyRelative("OnStatBelow"), new GUIContent("On " + name + " Below " + BelowValue.floatValue.ToString("F1")));
                                EditorGUILayout.PropertyField(element.FindPropertyRelative("OnStatAbove"), new GUIContent("On " + name + " Above " + AboveValue.floatValue.ToString("F1")));
                            }
                        }
                        EditorGUILayout.EndVertical();
                    }
                }
                EditorGUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Stats Modified");
                EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 10
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Use to animate a transform to this values");

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

                    EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("animTrans"), new GUIContent("Used for"));
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                    {
                        EditorGUIUtility.labelWidth = 50;
                        var type = My.animTrans == TransformAnimation.AnimTransType.TransformAnimation;
                        My.time  = EditorGUILayout.FloatField(new GUIContent(type ? "Time" : "Mount", type ? "Duration of the animation" : "Scale for the Mount Animation on the MountTriger Script"), My.time);
                        My.delay = EditorGUILayout.FloatField(new GUIContent(type ? "Delay" : "Dismount", type ? "Delay before the animation is started" : "Scale for the Dismount Animation on the MountTriger Script"), My.delay);
                        EditorGUIUtility.labelWidth = 0;
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                    {
                        My.UsePosition = GUILayout.Toggle(My.UsePosition, new GUIContent("Position"), EditorStyles.miniButton);
                        My.UseRotation = GUILayout.Toggle(My.UseRotation, new GUIContent("Rotation"), EditorStyles.miniButton);
                        My.UseScale    = GUILayout.Toggle(My.UseScale, new GUIContent("Scale"), EditorStyles.miniButton);
                    }
                    EditorGUILayout.EndHorizontal();

                    if (My.UsePosition)
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUILayout.BeginHorizontal();
                            {
                                My.SeparateAxisPos = GUILayout.Toggle(My.SeparateAxisPos, new GUIContent("|", "Separated Axis"), EditorStyles.miniButton);
                                EditorGUILayout.LabelField("Position", GUILayout.MinWidth(50), GUILayout.MaxWidth(100));
                                My.Position = EditorGUILayout.Vector3Field("", My.Position, GUILayout.MinWidth(120));
                                if (!My.SeparateAxisPos)
                                {
                                    My.PosCurve = EditorGUILayout.CurveField(My.PosCurve, GUILayout.MinWidth(30));
                                }
                            }
                            EditorGUILayout.EndHorizontal();

                            if (My.SeparateAxisPos)
                            {
                                EditorGUILayout.BeginHorizontal();
                                {
                                    My.PosXCurve = EditorGUILayout.CurveField(My.PosXCurve, Color.red, new Rect());
                                    My.PosYCurve = EditorGUILayout.CurveField(My.PosYCurve, Color.green, new Rect());
                                    My.PosZCurve = EditorGUILayout.CurveField(My.PosZCurve, Color.blue, new Rect());
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                        }
                        EditorGUILayout.EndVertical();
                    }

                    if (My.UseRotation)
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        {
                            EditorGUILayout.BeginHorizontal();
                            {
                                My.SeparateAxisRot = GUILayout.Toggle(My.SeparateAxisRot, new GUIContent("|", "Separated Axis"), EditorStyles.miniButton);
                                EditorGUILayout.LabelField("Rotation", GUILayout.MinWidth(50), GUILayout.MaxWidth(100));
                                My.Rotation = EditorGUILayout.Vector3Field("", My.Rotation, GUILayout.MinWidth(120));
                                if (!My.SeparateAxisRot)
                                {
                                    My.RotCurve = EditorGUILayout.CurveField(My.RotCurve, GUILayout.MinWidth(30));
                                }
                            }
                            EditorGUILayout.EndHorizontal();

                            if (My.SeparateAxisRot)
                            {
                                EditorGUILayout.BeginHorizontal();
                                {
                                    My.RotXCurve = EditorGUILayout.CurveField(My.RotXCurve, Color.red, new Rect());
                                    My.RotYCurve = EditorGUILayout.CurveField(My.RotYCurve, Color.green, new Rect());
                                    My.RotZCurve = EditorGUILayout.CurveField(My.RotZCurve, Color.blue, new Rect());
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                        }
                        EditorGUILayout.EndVertical();
                    }

                    if (My.UseScale)
                    {
                        EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                        {
                            EditorGUILayout.LabelField("Scale", GUILayout.MinWidth(50), GUILayout.MaxWidth(100));
                            My.Scale      = EditorGUILayout.Vector3Field("", My.Scale, GUILayout.MinWidth(120));
                            My.ScaleCurve = EditorGUILayout.CurveField(My.ScaleCurve, GUILayout.MinWidth(50));
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
                EditorGUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(target, "Transform Animation Inspector");
                EditorUtility.SetDirty(target);
            }
            serializedObject.ApplyModifiedProperties();
        }