Ejemplo n.º 1
0
    //技能伤害
    public void AttackDamage(EntityBase entity, int skillID, Vector3 blackAirPos)
    {
        SkillCfg   skillData  = resSvc.GetSkillCfgData(skillID);
        List <int> actionList = skillData.skillActionList;

        int sum = 0;

        for (int i = 0; i < actionList.Count; i++)
        {
            SkillActionCfg skillAction = resSvc.GetSkillActionData(actionList[i]);
            sum += skillAction.delayTime;
            int index = i;
            if (sum > 0)//延迟伤害,比如火圈范围持续伤害
            {
                int attackid = timeSvc.AddTimeTask((int tid) =>
                {
                    if (entity != null) //多个攻击同时打过来,已经死亡就会报空
                    {
                        SkillAction(entity, skillData, index, blackAirPos);
                        entity.RemoveActionCallBake(tid);
                    }
                    if (skillData.ID == 302)//黑气技能,无限循环存在
                    {
                        LoopSkill(entity, skillData, index, sum, blackAirPos);
                    }
                }, sum * 1.0f / 1000);
                entity.skillActionCallBackList.Add(attackid);
            }
            else//瞬间伤害
            {
                SkillAction(entity, skillData, index, Vector3.zero);
            }
        }
    }