Esempio n. 1
0
        /// <summary>
        /// When inspecting a Character, adds to the regular inspector some labels, useful for debugging
        /// </summary>
        public override void OnInspectorGUI()
        {
            CharacterAbility t = (target as CharacterAbility);

            serializedObject.Update();
            EditorGUI.BeginChangeCheck();

            if (t.HelpBoxText() != "")
            {
                EditorGUILayout.HelpBox(t.HelpBoxText(), MessageType.Info);
            }

            Editor.DrawPropertiesExcluding(serializedObject, new string[] { "AbilityStartFeedbacks", "AbilityStopFeedbacks" });

            EditorGUILayout.Space();

            if (_propertiesToHide.Count > 0)
            {
                if (_propertiesToHide.Count < 2)
                {
                    EditorGUILayout.LabelField("Feedbacks", EditorStyles.boldLabel);
                }
                if (!_propertiesToHide.Contains("AbilityStartFeedbacks"))
                {
                    EditorGUILayout.PropertyField(_abilityStartFeedbacks);
                }
                if (!_propertiesToHide.Contains("AbilityStopFeedbacks"))
                {
                    EditorGUILayout.PropertyField(_abilityStopFeedbacks);
                }
            }
            else
            {
                EditorGUILayout.LabelField("Feedbacks", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(_abilityStartFeedbacks);
                EditorGUILayout.PropertyField(_abilityStopFeedbacks);
            }

            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// When inspecting a Character, adds to the regular inspector some labels, useful for debugging
        /// </summary>
        public override void OnInspectorGUI()
        {
            CharacterAbility t = (target as CharacterAbility);

            serializedObject.Update();

            if (t.HelpBoxText() != "")
            {
                EditorGUILayout.HelpBox(t.HelpBoxText(), MessageType.Info);
            }

            Editor.DrawPropertiesExcluding(serializedObject, new string[] { "AbilityStartSfx", "AbilityInProgressSfx", "AbilityStopSfx" });

            EditorGUILayout.Space();

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.GetControlRect(true, 16f, EditorStyles.foldout);
            Rect foldRect = GUILayoutUtility.GetLastRect();

            if (Event.current.type == EventType.MouseUp && foldRect.Contains(Event.current.mousePosition))
            {
                _foldout    = !_foldout;
                GUI.changed = true;
                Event.current.Use();
            }
            _foldout = EditorGUI.Foldout(foldRect, _foldout, "Ability Sounds");

            if (_foldout)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(AbilityStartSfx);
                EditorGUILayout.PropertyField(AbilityInProgressSfx);
                EditorGUILayout.PropertyField(AbilityStopSfx);
                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
        }