Esempio n. 1
0
    void TryDisplaySkill()
    {
        //播放技能
        Jyx2Skill skill  = ConfigTable.Get <Jyx2Skill>(SkillId.ToString());
        var       wugong = new WugongInstance(SkillId);

        SkillCastHelper helper = new SkillCastHelper();

        helper.Source  = player;
        helper.Targets = enemys;

        wugong.Level   = SkillLevel;
        helper.Zhaoshi = new BattleZhaoshiInstance(wugong);

        //直接在每个敌人身上受击
        List <Transform> blocks = new List <Transform>();

        foreach (var e in enemys)
        {
            blocks.Add(e.transform);
        }
        helper.CoverBlocks = blocks;

        helper.Play();
    }
Esempio n. 2
0
    void CastSkill()
    {
        m_role.SwitchAnimationToSkill(m_skill.Data);

        m_skill.CastCD();
        m_skill.CastCost(m_role);

        List <RoleInstance> beHitAnimationList = new List <RoleInstance>();
        //获取攻击范围
        var coverBlocks = BattleManager.Instance.GetSkillCoverBlocks(m_skill, m_skillPos, m_role.Pos);

        //处理掉血
        foreach (var blockVector in coverBlocks)
        {
            var rolei = BattleManager.Instance.GetModel().GetAliveRole(blockVector);
            //还活着
            if (rolei == null || rolei.IsDead())
            {
                continue;
            }
            //打敌人的招式
            if (m_skill.IsCastToEnemy() && rolei.team == m_role.team)
            {
                continue;
            }
            //“打”自己人的招式
            if (!m_skill.IsCastToEnemy() && rolei.team != m_role.team)
            {
                continue;
            }

            var result = AIManager.Instance.GetSkillResult(m_role, rolei, m_skill, blockVector);

            result.Run();

            if (result.IsDamage())
            {
                //加入到受击动作List
                beHitAnimationList.Add(rolei);
            }
        }

        SkillCastHelper castHelper = new SkillCastHelper
        {
            Source      = m_role.View,
            CoverBlocks = coverBlocks.ToTransforms(),
            Zhaoshi     = m_skill,
            Targets     = beHitAnimationList.ToMapRoles(),
        };

        if (attackTwiceCounter < m_role.Zuoyouhubo)
        {
            castHelper.Play(() => {
                attackTwiceCounter++;
                CastSkill();
            });
        }
        else
        {
            castHelper.Play(() => {
                foreach (var role in beHitAnimationList)
                {
                    role.CheckDeath();
                }
                OnCaskSkillOver();
            });
        }
    }