Beispiel #1
0
        void DrawActive(int id)
        {
            if (!(id < mData.AnimationSkillList.Count))
            {
                return;
            }

            for (int i = 0; i < mData.AnimationSkillList[id].ActiveStructList.Count; i++)
            {
                ActiveStruct _eff = mData.AnimationSkillList[id].ActiveStructList[i];

                EditorGUI.indentLevel++;
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                string _titleName = "Active" + (i + 1).ToString();
                EditorGUILayout.BeginHorizontal();
                //此子特效的界面折叠
                _eff.isFoldout = EditorGUILayout.Foldout(_eff.isFoldout, _titleName);
                GUILayout.FlexibleSpace();
                //此子特效是否可用
                _eff.isEnabled = EditorGUILayout.Toggle("", _eff.isEnabled);

                if (GUILayout.Button("DELETE"))
                {
                    mData.AnimationSkillList[id].ActiveStructList.Remove(_eff);
                    return;
                }

                EditorGUILayout.EndHorizontal();

                mData.AnimationSkillList[id].ActiveStructList[i] = _eff;

                if (_eff.isFoldout)
                {
                    EditorGUI.BeginDisabledGroup(!_eff.isEnabled);
                    _eff.DelayTime = EditorGUILayout.FloatField("Delay Time", _eff.DelayTime);
                    if (_eff.DelayTime > mData.AnimationSkillList[id].fTime)
                    {
                        _eff.DelayTime = mData.AnimationSkillList[id].fTime;
                    }

                    _eff.gameObject = (GameObject)EditorGUILayout.ObjectField("GameObject", _eff.gameObject, typeof(GameObject), true);
                    _eff.isActive   = EditorGUILayout.Toggle("IsActive", _eff.isActive);

                    mData.AnimationSkillList[id].ActiveStructList[i] = _eff;
                }
                EditorGUI.EndDisabledGroup();


                EditorGUILayout.EndVertical();
                EditorGUI.indentLevel--;
            }
        }
Beispiel #2
0
        IEnumerator WaitPlayActive(ActiveStruct es)
        {
            //如果特效没有启用则不进行播放
            if (es.isEnabled)
            {
                yield return(new WaitForSeconds(es.DelayTime));
            }
            else
            {
                yield break;
            }

            es.gameObject.SetActive(es.isActive);
            yield return(new WaitForEndOfFrame());
        }
Beispiel #3
0
        void DrawAnimation()
        {
            if (mData.AnimationSkillList == null)
            {
                return;
            }

            for (int i = 0; i < mData.AnimationSkillList.Count; i++)
            {
                EditorGUILayout.Space();

                AnimationSkillStruct _ass = mData.AnimationSkillList[i];
                if (_ass.Type == NFAnimaStateType.NONE)
                {
                    continue;
                }

                if (_ass.IsFoldout)
                {
                    EditorGUILayout.BeginVertical(EditorStyles.helpBox);

                    _ass.fCurTime = EditorGUILayout.Slider(_ass.Type.ToString(), _ass.fCurTime, 0f, _ass.fTime);
                    if (_ass.fCurTime > 0)
                    {
                        for (int j = 0; j < mData.AnimationSkillList.Count; j++)
                        {
                            if (i != j)
                            {
                                mData.AnimationSkillList[j].fCurTime = 0f;
                            }
                        }

                        m_CurrentTime  = _ass.fCurTime / _ass.fTime;
                        mManulPlayType = _ass.Type;
                    }

                    EditorGUILayout.BeginHorizontal();
                    _ass.fSpeed  = EditorGUILayout.FloatField("Play Speed:", _ass.fSpeed);
                    _ass.visible = EditorGUILayout.Toggle("Visible:", _ass.visible);

                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("Play"))
                    {
                        //mASC.SetAnimator(mASC.GetComponent<Animator>());
                        _ass.fCurTime  = 0f;
                        m_CurrentTime  = 0f;
                        mManulPlayType = NFAnimaStateType.NONE;
                        mPlayType      = _ass.Type;
                        mASC.PlayAnimaState(mPlayType, -1);
                    }

                    if (GUILayout.Button("Stop"))
                    {
                        _ass.fCurTime  = 0f;
                        m_CurrentTime  = 0f;
                        mManulPlayType = NFAnimaStateType.NONE;
                        mPlayType      = NFAnimaStateType.Idle;
                        mASC.PlayAnimaState(NFAnimaStateType.Idle, -1);

                        for (int j = 0; j < mData.AnimationSkillList.Count; j++)
                        {
                            mData.AnimationSkillList[j].fCurTime = 0f;
                        }
                    }

                    if (GUILayout.Button("FIX ANIM"))
                    {
                        FixAllAnims();
                    }

                    EditorGUILayout.EndHorizontal();

                    _ass.AnimationClip = (AnimationClip)EditorGUILayout.ObjectField("AnimaitonClip:", _ass.AnimationClip, typeof(AnimationClip), true);

                    EditorGUILayout.BeginHorizontal();
                    if (_ass.AnimationClip == null)
                    {
                        _ass.fTime = 1f;
                    }
                    else
                    {
                        _ass.fTime = _ass.AnimationClip.length / _ass.fSpeed;
                    }
                    EditorGUILayout.LabelField("NextAnima After:", _ass.fTime.ToString());
                    _ass.NextType = (NFAnimaStateType)EditorGUILayout.EnumPopup(_ass.NextType);

                    EditorGUILayout.EndHorizontal();



                    mData.AnimationSkillList[i] = _ass;

                    //添加特效与删除片断
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("ADD EFFECT"))
                    {
                        EffectStruct _es = new EffectStruct();
                        _es.LifeTime  = 3;
                        _es.isFoldout = true;
                        mData.AnimationSkillList[i].EffectStructList.Add(_es);
                    }
                    if (GUILayout.Button("ADD Audio"))
                    {
                        AudioStruct _es = new AudioStruct();
                        _es.LifeTime  = 3;
                        _es.isFoldout = true;
                        mData.AnimationSkillList[i].AudioStructList.Add(_es);
                    }
                    if (GUILayout.Button("ADD Bullet"))
                    {
                        BulletStruct _es = new BulletStruct();
                        _es.isFoldout = true;
                        mData.AnimationSkillList[i].BulletStructList.Add(_es);
                    }



                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("ADD Damage"))
                    {
                        DamageStruct _es = new DamageStruct();
                        _es.isFoldout = true;
                        mData.AnimationSkillList[i].DamageStructList.Add(_es);
                    }

                    if (GUILayout.Button("ADD Movement"))
                    {
                        MovementStruct _es = new MovementStruct();
                        _es.isFoldout = true;
                        mData.AnimationSkillList[i].MovementStructList.Add(_es);
                    }

                    if (GUILayout.Button("ADD Camera"))
                    {
                        CameraStruct _es = new CameraStruct();
                        _es.isFoldout = true;
                        mData.AnimationSkillList[i].CameraStructList.Add(_es);
                    }
                    if (GUILayout.Button("ADD Active"))
                    {
                        ActiveStruct _es = new ActiveStruct();
                        _es.isActive = false;
                        mData.AnimationSkillList[i].ActiveStructList.Add(_es);
                    }

                    EditorGUILayout.EndHorizontal();

                    if (mData.AnimationSkillList.Count > 0)
                    {
                        DrawEffect(i);
                        DrawAudio(i);
                        DrawMovement(i);
                        DrawDamage(i);
                        DrawBullet(i);
                        DrawCamera(i);
                        DrawActive(i);
                    }
                    EditorGUILayout.EndVertical();
                }
            }
        }