Exemplo n.º 1
0
        private void PlaySkillTimeLine()
        {
            if (SelSkill == null)
            {
                return;
            }
            TimeLineHelp.Clear();
            TimeLine line = TimeLineHelp.CreateTimeLine();

            //Effect
            for (int i = 0; i < SelSkill.Effects.Count; i++)
            {
                SkillEffectJson effect = SelSkill.Effects[i];
                line.AddTrack((float)effect.Time, 0).OnStart(() => {
                    Debug.Log("Effect》》》》》》》");
                });
            }

            //Audio
            for (int i = 0; i < SelSkill.Audios.Count; i++)
            {
                SkillAudioJson audio = SelSkill.Audios[i];
                line.AddTrack((float)audio.Time, 0).OnStart(() => {
                    Debug.Log("Audio》》》》》》》");
                });
            }
        }
Exemplo n.º 2
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;
        }