Exemplo n.º 1
0
        /// <summary>
        /// Returns the actions to draw before the State list is drawn.
        /// </summary>
        /// <returns>The actions to draw before the State list is drawn.</returns>
        protected override Action GetDrawCallback()
        {
            var baseCallback = base.GetDrawCallback();

            baseCallback += () =>
            {
                EditorGUILayout.PropertyField(PropertyFromName("m_RequireAim"));
                EditorGUILayout.PropertyField(PropertyFromName("m_AbsorptionFactor"));
                EditorGUILayout.PropertyField(PropertyFromName("m_AbsorbExplosions"));
                // The names will be retrieved by the Attribute Manager.
                var attributeName = InspectorUtility.DrawAttribute(target, m_AttributeManager, (target as Shield).DurabilityAttributeName, "Durability Attribute");
                if (attributeName != (target as Shield).DurabilityAttributeName)
                {
                    PropertyFromName("m_DurabilityAttributeName").stringValue = attributeName;
                    serializedObject.ApplyModifiedProperties();
                }
                if (!string.IsNullOrEmpty(attributeName))
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(PropertyFromName("m_DropWhenDurabilityDepleted"));
                    EditorGUI.indentLevel--;
                }

                if (Foldout("Impact"))
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(PropertyFromName("m_ApplyImpact"));
                    InspectorUtility.DrawAnimationEventTrigger(target, "Impact Complete Event", PropertyFromName("m_ImpactCompleteEvent"));
                    if (Foldout("Animator Audio"))
                    {
                        EditorGUI.indentLevel++;
                        AnimatorAudioStateSetInspector.DrawAnimatorAudioStateSet(m_Shield, m_Shield.ImpactAnimatorAudioStateSet, "m_ImpactAnimatorAudioStateSet", true,
                                                                                 ref m_ReorderableImpactAnimatorAudioStateSetList, OnImpactAnimatorAudioStateListDraw, OnImpactAnimatorAudioStateListSelect,
                                                                                 OnImpactAnimatorAudioStateListAdd, OnImpactAnimatorAudioStateListRemove, SelectedImpactAnimatorAudioStateSetIndexKey,
                                                                                 ref m_ReorderableImpactAnimatorAudioStateSetAudioList, OnImpactAudioListElementDraw, OnImpactAudioListAdd, OnImpactAudioListRemove,
                                                                                 ref m_ReorderableImpactAnimatorAudioStateSetStateList, OnImpactAnimatorAudioStateSetStateListDraw, OnImpactAnimatorAudioStateSetStateListAdd,
                                                                                 OnImpactAnimatorAudioStateSetStateListReorder, OnImpactAnimatorAudioStateListRemove,
                                                                                 GetSelectedImpactAnimatorAudioStateSetStateIndexKey(EditorPrefs.GetInt(SelectedImpactAnimatorAudioStateSetIndexKey)));
                        EditorGUI.indentLevel--;
                    }
                }

                GUI.enabled = true;
            };

            return(baseCallback);
        }
        /// <summary>
        /// Returns the actions to draw before the State list is drawn.
        /// </summary>
        /// <returns>The actions to draw before the State list is drawn.</returns>
        protected override Action GetDrawCallback()
        {
            var baseCallback = base.GetDrawCallback();

            baseCallback += () =>
            {
                if (Foldout("Use"))
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(PropertyFromName("m_UseRate"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_CanEquipEmptyItem"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_FaceTarget"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_StopUseAbilityDelay"));
                    InspectorUtility.DrawAnimationEventTrigger(target, "Use Event", PropertyFromName("m_UseEvent"));
                    InspectorUtility.DrawAnimationEventTrigger(target, "Use Complete Event", PropertyFromName("m_UseCompleteEvent"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_ForceRootMotionPosition"));
                    EditorGUILayout.PropertyField(PropertyFromName("m_ForceRootMotionRotation"));
                    if (Foldout("Attributes"))
                    {
                        EditorGUI.indentLevel++;
                        var attributeName = InspectorUtility.DrawAttribute(target, m_AttributeManager, m_UsableItem.UseAttributeName, "Use Attribute");
                        if (attributeName != m_UsableItem.UseAttributeName)
                        {
                            m_UsableItem.UseAttributeName = attributeName;
                            InspectorUtility.SetDirty(target);
                        }
                        if (!string.IsNullOrEmpty(m_UsableItem.UseAttributeName))
                        {
                            EditorGUI.indentLevel++;
                            EditorGUILayout.PropertyField(PropertyFromName("m_UseAttributeAmount"), new GUIContent("Use Amount"));
                            EditorGUILayout.PropertyField(PropertyFromName("m_DropWhenUseDepleted"));
                            EditorGUI.indentLevel--;
                        }
                        attributeName = InspectorUtility.DrawAttribute(target, m_CharacterAttributeManager, m_UsableItem.CharacterUseAttributeName, "Character Use Attribute");
                        if (attributeName != m_UsableItem.CharacterUseAttributeName)
                        {
                            m_UsableItem.CharacterUseAttributeName = attributeName;
                            InspectorUtility.SetDirty(target);
                        }
                        if (!string.IsNullOrEmpty(m_UsableItem.CharacterUseAttributeName))
                        {
                            EditorGUI.indentLevel++;
                            EditorGUILayout.PropertyField(PropertyFromName("m_CharacterUseAttributeAmount"), new GUIContent("Use Amount"));
                            EditorGUI.indentLevel--;
                        }
                        EditorGUI.indentLevel--;
                    }
                    if (Foldout("Animator Audio"))
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(PropertyFromName("m_PlayAudioOnStartUse"));
                        AnimatorAudioStateSetInspector.DrawAnimatorAudioStateSet(m_UsableItem, m_UsableItem.UseAnimatorAudioStateSet, "m_UseAnimatorAudioStateSet", true,
                                                                                 ref m_ReorderableUseAnimatorAudioStateSetAudioList, OnAnimatorAudioStateListDraw, OnAnimatorAudioStateListSelect,
                                                                                 OnAnimatorAudioStateListAdd, OnAnimatorAudioStateListRemove, SelectedUseAnimatorAudioStateSetIndexKey,
                                                                                 ref m_ReorderableUseAnimatorAudioStateSetList, OnUseAudioListElementDraw, OnUseAudioListAdd, OnUseAudioListRemove,
                                                                                 ref m_ReorderableUseAnimatorAudioStateSetStateList, OnAnimatorAudioStateSetStateListDraw, OnAnimatorAudioStateSetStateListAdd,
                                                                                 OnAnimatorAudioStateSetStateListReorder, OnAnimatorAudioStateSetStateListRemove,
                                                                                 GetSelectedAnimatorAudioStateSetStateIndexKey(EditorPrefs.GetInt(SelectedUseAnimatorAudioStateSetIndexKey)));
                        EditorGUI.indentLevel--;
                    }
                }
            };

            return(baseCallback);
        }