예제 #1
0
        private void HandleSkill(SkillCom skillCom)
        {
            //没有技能释放请求
            if (skillCom.SkillId <= 0)
            {
                return;
            }

            //生成一个时间线
            if (skillCom.Line == null)
            {
                skillCom.Line = TimeLineHelp.CreateTimeLine();
            }
            else
            {
                skillCom.Line = TimeLineHelp.AddTimeLine(skillCom.Line);
            }

            //重置
            skillCom.Line.ReSet();

            SkillJson json = GameConfigHelp.GetSkillInfo(skillCom.SkillId);

            //播放动画
            for (int i = 0; i < json.AnimClips.Count; i++)
            {
                SkillAnimJson animJson = json.AnimClips[i];
                skillCom.Line.AddTrack((float)animJson.Time, 0).OnStart(() => {
                    PlayAnim(skillCom, animJson.AnimName);
                });
            }
            //播放特效
            for (int i = 0; i < json.Effects.Count; i++)
            {
                SkillEffectJson effectJson = json.Effects[i];
                skillCom.Line.AddTrack((float)effectJson.Time, 0).OnStart(() => {
                    PlayEffect(skillCom, effectJson);
                });
            }
            //播放音效
            for (int i = 0; i < json.Audios.Count; i++)
            {
                SkillAudioJson audioJson = json.Audios[i];
                skillCom.Line.AddTrack((float)audioJson.Time, 0).OnStart(() => {
                    PlayAudio(skillCom, audioJson.AudioId);
                });
            }
            //处理数据
            HandleSkillData(skillCom, json.Data);

            //开始播放技能
            skillCom.Line.Start();

            //重置
            skillCom.SkillId = 0;
        }
예제 #2
0
 //特效
 private void PlayEffect(SkillCom skillCom, SkillEffectJson effect)
 {
     if (effect.EffectId <= 0)
     {
         ECSLocate.ECSLog.LogR("特效Id 为空>>>>>>> ", skillCom.SkillId, effect.EffectId);
         return;
     }
     ECSLocate.ECSLog.LogR("播放特效>>>>>>>>>", effect.EffectId);
     ECSLocate.ECS.SetGlobalSingleComData((EffectCom com) =>
     {
         com.CurrShowEffectId = effect.EffectId;
         com.EntityId         = skillCom.EntityId;
         com.ShowPos          = (Vector3)LCConvert.StrChangeToObject(effect.Pos, typeof(Vector3).FullName);
     });
 }