Ejemplo n.º 1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            position.height     = 16f;
            property.isExpanded = EditorGUI.Foldout(position, property.isExpanded, label);
            if (property.isExpanded)
            {
                EditorGUI.indentLevel++;

                _rectYPosition = position.y + 18f;

                SerializedProperty typeProperty = property.FindPropertyRelative("_type");
                DrawProperty(position, typeProperty);

                AnimationCoroutine.Type mode = (AnimationCoroutine.Type)typeProperty.enumValueIndex;
                switch (mode)
                {
                case AnimationCoroutine.Type.Animation:
                    DrawProperty(position, property.FindPropertyRelative("_animation"));
                    DrawProperty(position, property.FindPropertyRelative("_animationName"));
                    break;

                case AnimationCoroutine.Type.Animator:
                    DrawProperty(position, property.FindPropertyRelative("_animator"));
                    DrawProperty(position, property.FindPropertyRelative("_animatorState"));
                    DrawProperty(position, property.FindPropertyRelative("_animatorLayer"));
                    break;

                case AnimationCoroutine.Type.Custom:
                    DrawProperty(position, property.FindPropertyRelative("_customCallbackEvent"));
                    break;

#if DOTWEENPRO
                case AnimationCoroutine.Type.DOTween:
                    DrawProperty(position, property.FindPropertyRelative("_doTweenAnimation"), "Animation");
                    break;
#endif
                default:
                    break;
                }

                DrawProperty(position, property.FindPropertyRelative("_onStart"));
                DrawProperty(position, property.FindPropertyRelative("_onFinish"));
            }
        }
Ejemplo n.º 2
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            float height = 18f;

            if (property.isExpanded)
            {
                SerializedProperty typeProperty = property.FindPropertyRelative("_type");
                height += EditorGUI.GetPropertyHeight(typeProperty);
                AnimationCoroutine.Type mode = (AnimationCoroutine.Type)typeProperty.enumValueIndex;
                switch (mode)
                {
                case AnimationCoroutine.Type.Animation:
                    height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("_animation"));
                    height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("_animationName"));
                    break;

                case AnimationCoroutine.Type.Animator:
                    height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("_animator"));
                    height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("_animatorState"));
                    height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("_animatorLayer"));
                    break;

                case AnimationCoroutine.Type.Custom:
                    height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("_customCallbackEvent"));
                    break;

#if DOTWEENPRO
                case AnimationCoroutine.Type.DOTween:
                    height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("_doTweenAnimation"));
                    break;
#endif
                default:
                    break;
                }
                height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("_onStart"));
                height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("_onFinish"));
            }
            return(height);
        }