Exemplo n.º 1
0
        //下面是一些组件接口

        //1,播放动画
        public virtual void PlayAction(string strAction, bool isCrossFade = true, ActionVoiceDesc voiceDesc = null)
        {
            if (!IsHadAction(strAction))
            {
                return;
            }

            m_curActionName = strAction;

            if (isCrossFade)
            {
                if (IsUpperAndBasePart)
                {
                    UpperPart.GetComponent <Animation>().CrossFade(strAction, 0.1f);
                    if (BasePart != null)
                    {
                        if (IsHadAction(strAction, BasePart.GetComponent <Animation>()))
                        {
                            BasePart.GetComponent <Animation>().CrossFade(strAction, 0.1f);
                        }
                    }
                }
                else
                {
                    m_Animation.CrossFade(strAction, 0.1f);
                }
            }
            else
            {
                if (IsUpperAndBasePart)
                {
                    UpperPart.GetComponent <Animation>().Play(strAction);
                    if (BasePart != null)
                    {
                        if (IsHadAction(strAction, BasePart.GetComponent <Animation>()))
                        {
                            BasePart.GetComponent <Animation>().Play(strAction);
                        }
                    }
                }
                else
                {
                    m_Animation.Play(strAction);
                }
            }
        }
Exemplo n.º 2
0
        //是否存在action
        public bool IsHadAction(string strAction)
        {
            AnimationState state = null;

            if (IsUpperAndBasePart == false)
            {
                if (null != m_Animation)
                {
                    state = m_Animation[strAction];
                }
            }
            else
            {
                Animation an = UpperPart.GetComponent <Animation>();
                if (null != an)
                {
                    state = an[strAction];
                }
            }

            return(state != null);
        }