Пример #1
0
        /// <summary>
        /// 响应受击消息
        /// </summary>
        /// <param name="beattackMsg"></param>
        void HandleBeattacked(S2CNwarHit beattackMsg)
        {
            if (!mIsRecvMsg)
            {
                return;
            }

            DBSkillSev.SkillInfoSev skillInfo = DBSkillSev.Instance.GetSkillInfo(beattackMsg.hit.skill_id);
            if (skillInfo == null)
            {
                GameDebug.LogError(string.Format("[HandleBeattacked]Skill ID:{0} info is null", beattackMsg.hit.skill_id));
                return;
            }

            Damage dmg    = new Damage();
            uint   src_id = beattackMsg.hit.act_id;
            Actor  actor  = ActorManager.Instance.GetPlayer(beattackMsg.hit.act_id);

            // 本地玩家受击,攻击者在角色列表中找不到的时候,需要给服务端发送look消息(目前AOI有bug)
            if (actor == null && mOwner != null && mOwner.IsLocalPlayer)
            {
                mMissUID.obj_idx = beattackMsg.hit.act_id;
                var cacheInfo = ActorManager.Instance.GetUnitCacheInfo(mMissUID);
                if (cacheInfo == null)
                {
                    var sendLookFix = new C2SNwarLookFix();
                    sendLookFix.uuid = beattackMsg.hit.act_id;
                    NetClient.GetCrossClient().SendData <C2SNwarLookFix>(NetMsg.MSG_NWAR_LOOK_FIX, sendLookFix);
                }
            }

            if (beattackMsg.hit.ori_type == GameConst.SKILL_ORI_PET)
            {
                if (actor != null)
                {
                    Player player = actor as Player;
                    if (player != null && player.CurrentPet != null)
                    {
                        src_id = player.CurrentPet.obj_idx;
                    }
                }
            }

            dmg.SrcID            = src_id;
            dmg.TargetID         = beattackMsg.hit.dst_id;
            dmg.SkillID          = beattackMsg.hit.skill_id;
            dmg.BeattackState    = Damage.EBeattackState.BS_BendBack;
            dmg.DamageEffectType = beattackMsg.hit.hit_type;
            dmg.DamageValue      = (int)beattackMsg.hit.dmg;
            dmg.DamageSpecs      = new Dictionary <uint, int>(beattackMsg.hit.specs.Count);
            foreach (var spec in beattackMsg.hit.specs)
            {
                dmg.DamageSpecs.Add(spec.k, (int)spec.v);
            }

            SkillAttackInstance inst = EffectManager.GetInstance().GetAttackInstance(beattackMsg.hit.em_id);

            if (inst != null)
            {
                inst.AddHurtInfo(dmg);
            }
            else
            {
                dmg.HitEffect();
            }

            LastAttackerId = beattackMsg.hit.act_id;
        }
Пример #2
0
 public virtual void BeAttack(Damage dam)
 {
     return;
 }