예제 #1
0
    protected void doSkill(SkillItemUIData skillData)
    {
        SkillType type = skillData.skillType;

        switch (type)
        {
        case SkillType.normal:    //普通技能 距离 水平角度  垂直角度 //AOI管理实体视野周围的所有实体 方便获取一定范围内的实体 这里直接拿所有实体
            List <BaseEntity> targetLst = EntityMgr.Instance.getEntityByType(EntityType.monster);
            AttackInfo        info      = new AttackInfo(skillData.atkRange, skillData.horAngle, skillData.verAngle);
            if (targetLst != null && targetLst.Count > 0)
            {
                for (int i = 0; i < targetLst.Count; i++)
                {
                    bool isAttacked = AttackHelper.isAttacked(this.dyAgent, targetLst[i], info);
                    if (isAttacked)
                    {
                        DamageData dt = new DamageData();
                        dt.casterId = this.dyAgent.UID;
                        dt.targetId = targetLst[i].UID;
                        dt.atkType  = skillData.atkType;
                        dt.hitDis   = skillData.hitDis;
                        dt.damage   = skillData.skillDamage;
                        targetLst[i].onDamage(dt);
                    }
                }
            }
            this.nextAttackTime = -1;
            break;

        case SkillType.bullet:    //子弹技能 由子弹碰撞做伤害检测
            BulletFactroy.createBullet(this.dyAgent, skillData.skillBulletId);
            this.nextAttackTime = -1;
            break;
        }
    }