예제 #1
0
        /// <summary>
        /// 播放完动作后,默认播放待机
        /// </summary>
        public void PlayAnima(int animaId, Action playerEnd = null, bool bCross = true, float playSpeed = 1.0f)
        {
            if (m_animaInfo == null)
            {
                m_animaInfo = new AnimationAction();
            }

            AnimationCsvData animData = CsvManager.Inst.GetCsv <AnimationCsv>((int)eAllCSV.eAC_Animation).GetData(animaId);

            if (animData == null)
            {
                //Debug.LogError("动作为空 id= " + animaId);
                return;
            }

            // 通过优先级和技能保护时间,来判断是否需要播放
            if (animData.priority < m_animaPriority)
            {
                return;
            }

            m_animaPriority = animData.priority;
            //if(m_object != null)
            //Debug.LogWarning(m_object.name + " id: " + animaId +  " 设置优先级: " + m_animaPriority);

            if (bCross)
            {
                m_animaInfo.crossTime = AnimationInfo.m_crossTime;
            }

            if (animaId == SMtCreatureAnima.ANIMA_DIE)
            {
                m_animaInfo.crossTime = 0;
            }

            m_animaInfo.playSpeed = playSpeed * animData.speed;
            m_animaInfo.strFull   = animData.animationName;
            m_animaInfo.eMode     = (WrapMode)animData.mode;

            if (m_animaInfo.eMode == WrapMode.Once)
            {
                m_animaInfo.endEvent = playerEnd;
            }
            else
            {
                m_animaInfo.endEvent = null;
            }
            m_animaInfo.atOnce = animData.atOnce;
            Play(m_animaInfo);
        }
예제 #2
0
 protected override void _Load()
 {
     m_dicData.Clear();
     for (int i = 0; i < m_csv.GetRows(); i++)
     {
         AnimationCsvData data = new AnimationCsvData();
         data.animationID   = m_csv.GetIntData(i, (int)eAnimationCsv.animationID);
         data.animationName = m_csv.GetData(i, (int)eAnimationCsv.animationName);
         data.fadeLength    = m_csv.GetFloatData(i, (int)eAnimationCsv.fadeLength);
         data.speed         = m_csv.GetFloatData(i, (int)eAnimationCsv.speed);
         data.mode          = m_csv.GetIntData(i, (int)eAnimationCsv.mode);
         data.length        = m_csv.GetFloatData(i, (int)eAnimationCsv.length);
         data.priority      = m_csv.GetIntData(i, (int)eAnimationCsv.priority);
         data.atOnce        = m_csv.GetBoolData(i, (int)eAnimationCsv.atOnce);
         data.switchHand    = m_csv.GetBoolData(i, (int)eAnimationCsv.switchHand);
         data.name          = m_csv.GetData(i, (int)eAnimationCsv.name);
         m_dicData.Add(data.animationID, data);
     }
 }
예제 #3
0
        /// <summary>
        /// 常规技能的开始阶段
        /// 1.也包含了循环动作的技能,如旋风斩
        /// 2.支持背后武器火炮的攻击时,挂点的改变
        /// </summary>
        public virtual void Start()
        {
            BattleEntity ent     = m_casterObject.GetEnt() as BattleEntity;
            int          animaId = m_casterData.animaName;
            AnimationCsv anima   = CsvManager.Inst.GetCsv <AnimationCsv>((int)eAllCSV.eAC_Animation);

            m_curAnima = anima.GetData(animaId);
            if (m_curAnima != null)
            {
                CmdSkillAnimaPriority cmd = new CmdSkillAnimaPriority();
                m_casterObject.PushCommand(cmd);
                if (m_curAnima.mode == (int)WrapMode.Loop)
                {
                    ent.PlayAnima(animaId, null);
                }
                else
                {
                    if (m_curAnima.switchHand)  // 如果是火炮,特殊处理一下,施法时武器切换到手上
                    {
                        ent.BackEquipStart();
                    }
                    ent.PlayAnima(animaId, () =>
                    {
                        ent.BackEquipEnd();
                    });
                }
            }

            int effectId = m_casterData.effectId;

            if (m_casterData.startTime == 0)
            {
                m_curCasterEffectHid = CEffectMgr.Create(effectId, ent, m_casterData.bindPoint);
            }
            else
            {
                TimeMgr.Inst.RegisterEvent(m_casterData.startTime * 0.001f, () =>
                {
                    m_curCasterEffectHid = CEffectMgr.Create(effectId, ent, m_casterData.bindPoint);
                });
            }

            if (m_casterObject == null ||
                m_curSkillCmd == null ||
                m_casterObject.m_cmdUpdateEquip == null)
            {
                return;
            }

            // 播放语音,1手雷 2火炮
            //if (m_curSkillCmd.m_skillIndex == 0)
            //{
            //    if (m_casterObject.m_cmdUpdateEquip.m_armsType == (int)eArmsType.Near)
            //    {
            //        m_casterObject.PlaySpeak(eRoleSpeakCsv.skill1Near);
            //    }
            //    else
            //    {
            //        m_casterObject.PlaySpeak(eRoleSpeakCsv.skill1Far);
            //    }
            //}
            //else if(m_curSkillCmd.m_skillIndex == 1)
            //{
            //    m_casterObject.PlaySpeak(eRoleSpeakCsv.skill2);
            //}
            //else if(m_curSkillCmd.m_skillIndex == 2)
            //{
            //    m_casterObject.PlaySpeak(eRoleSpeakCsv.skill3);
            //}
        }