Exemplo n.º 1
0
        private static AnimationInterface DrawBehaviourAnimationAnimationData(ICEWorldBehaviour _control, AnimationInterface _animation_data)
        {
            Animation _animation = _control.GetComponentInChildren <Animation>();

            if (_animation != null && _animation.enabled == true)
            {
                Info.Help(Info.ANIMATION_ANIMATION);

                if (EditorApplication.isPlaying)
                {
                    EditorGUILayout.LabelField("Name", _animation_data.Name);
                }
                else
                {
                    string _animation_name = AnimationPopup(_animation, _animation_data.Name, "Animation (" + _animation_data.Length.ToString() + " secs.)", Info.ANIMATION_NAME);
                    if (_animation_name != _animation_data.Name)
                    {
                        AnimationState _state = AnimationTools.GetAnimationStateByName(_control.gameObject, _animation_name);
                        if (_state != null)
                        {
                            if (_state.clip != null)
                            {
                                _state.clip.legacy = true;
                            }

                            _animation_data.TransitionDuration = 0.25f;
                            _animation_data.wrapMode           = _state.wrapMode;
                            _animation_data.DefaultWrapMode    = _state.wrapMode;
                            _animation_data.Speed        = _state.speed;
                            _animation_data.DefaultSpeed = _state.speed;
                            _animation_data.Name         = _state.name;
                            _animation_data.Length       = _state.length;
                        }
                    }
                }

                EditorGUI.indentLevel++;
                _animation_data.wrapMode = DrawBehaviourAnimationWrapMode(_animation_data.wrapMode);
                DrawBehaviourAnimationData(ref _animation_data.Speed, ref _animation_data.AutoSpeed, ref _animation_data.TransitionDuration, ref _animation_data.AutoTransitionDuration, _animation_data.DefaultSpeed);

                if (_animation_data.AutoTransitionDuration)
                {
                    _animation_data.TransitionDuration = _animation_data.Length / 3;
                }

                EditorGUI.indentLevel--;
            }
            else
            {
                EditorGUILayout.HelpBox("Check your Animation Component", MessageType.Warning);
            }

            return(_animation_data);
        }
Exemplo n.º 2
0
        public static string AnimationPopup(Animation _animation, string _name, string _title = "", string _help = "")
        {
            ICEEditorLayout.BeginHorizontal();
            _name = AnimationPopupBase(_animation, _name, _title);

            if (ICEEditorLayout.SystemButtonSmall("SEL", ""))
            {
                AnimationState _state = AnimationTools.GetAnimationStateByName(_animation, _name);

                if (_state != null && _state.clip != null)
                {
                    Selection.activeObject = _state.clip;
                }
            }
            ICEEditorLayout.EndHorizontal(_help);

            return(_name);
        }
        private static AnimationInterface WizardAnimationPopupLegacy(string _title, ICECreatureControl _control, AnimationInterface _animation_data)
        {
            Animation m_animation = _control.GetComponentInChildren <Animation>();

            if (m_animation != null && m_animation.enabled == true)
            {
                if (EditorApplication.isPlaying)
                {
                    EditorGUILayout.LabelField("Name", _animation_data.Name);
                }
                else
                {
                    _animation_data.Name = AnimationEditor.AnimationPopupBase(m_animation, _animation_data.Name, _title);
                    AnimationState _state = AnimationTools.GetAnimationStateByName(_control.gameObject, _animation_data.Name);
                    if (_state != null)
                    {
                        if (_state.clip != null)
                        {
                            _state.clip.legacy = true;
                        }

                        if (_animation_data.Name != _state.name)
                        {
                            _animation_data.Name               = _state.name;
                            _animation_data.Length             = _state.length;
                            _animation_data.Speed              = _state.speed;
                            _animation_data.TransitionDuration = 0.25f;
                            _animation_data.wrapMode           = _state.wrapMode;

                            _animation_data.Length          = _state.length;
                            _animation_data.DefaultSpeed    = _state.speed;
                            _animation_data.DefaultWrapMode = _state.wrapMode;
                        }
                    }
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Check your Animation Component", MessageType.Warning);
            }

            return(_animation_data);
        }