示例#1
0
        bool mHideEffect        = false;                                                                                                          // 是否隐藏子弹特效

        /// <summary>
        /// 初始化
        /// </summary>
        public bool Init()
        {
            m_SkillInfo = DBSkillSev.Instance.GetSkillInfo(SkillID);
            m_SubEmitId = (ulong)(((ulong)ActorID << 32 & 0xffffffff00000000) | ((ulong)SkillID << 16 & 0xffffffffffff0000));  // 暂时使用技能ID和角色ID来进行组合
            if (m_SkillInfo != null && m_SkillInfo.BulletId != 0)
            {
                m_BulletInfo = DBBulletTrace.GetInstance().GetBulletInfo(m_SkillInfo.BulletId);
                if (m_BulletInfo != null)
                {
                    if (HitPlayers.Count > 0)
                    {
                        uint  hit_player_id = HitPlayers[0];
                        Actor src_player    = ActorManager.Instance.GetPlayer(ActorID);
                        Actor hitPlayer     = ActorManager.Instance.GetPlayer(hit_player_id);

                        if (src_player == null || hitPlayer == null || src_player.GetActorMono() == null || hitPlayer.GetActorMono() == null)
                        {
                            return(false);
                        }

                        ActorMono src_actormono = src_player.GetActorMono();
                        ActorMono hit_actormono = hitPlayer.GetActorMono();

                        BulletTrackInstance sub_bullet_trace = new xc.BulletTrackInstance(m_BulletInfo, m_SkillInfo, 0);
                        m_TraceInsts.Add(sub_bullet_trace);

                        // 开启新的BulletTrackInstance
                        mHideEffect = ShieldManager.Instance.IsHideBulletEffect(src_player, hitPlayer);
                        sub_bullet_trace.Do(m_SubEmitId, src_actormono, hit_actormono, mHideEffect, src_player.transform.position, src_player.transform.rotation, src_player.transform.forward, OnHit);

                        // 将伤害信息添加到新创建的SkillAttackInstance列表中
                        SkillAttackInstance attack_inst = EffectManager.GetInstance().GetAttackInstance(m_SubEmitId);
                        if (attack_inst != null)
                        {
                            Damage dmgInfo = null;
                            if (m_DamageInfos.TryGetValue(hit_player_id, out dmgInfo))
                            {
                                attack_inst.AddHurtInfo(dmgInfo);
                            }
                        }

                        m_HitEmits[hit_player_id] = new HitCacheInfo(m_SubEmitId);
                        m_SubEmitId++;

                        mLastThunderPlayer = hit_player_id;
                        HitPlayers.RemoveAt(0);
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#2
0
        /// <summary>
        /// 添加伤害数据
        /// </summary>
        public void AddHurtInfo(Damage damageInfo)
        {
            m_DamageInfos[damageInfo.TargetID] = damageInfo;

            HitCacheInfo info;

            if (m_HitEmits.TryGetValue(damageInfo.TargetID, out info))
            {
                SkillAttackInstance attack_inst = EffectManager.GetInstance().GetAttackInstance(info.SubEmitID);
                if (attack_inst != null)
                {
                    attack_inst.AddHurtInfo(damageInfo);
                }
            }
        }
示例#3
0
        /// <summary>
        /// 当命中一个角色后的回调
        /// </summary>
        /// <param name="sub_inst"></param>
        void OnHit(SkillAttackInstance sub_inst)
        {
            if (m_BulletInfo != null)
            {
                if (HitPlayers.Count > 0)
                {
                    uint  hit_player_id = HitPlayers[0];
                    Actor src_player    = ActorManager.Instance.GetPlayer(mLastThunderPlayer);
                    Actor hitPlayer     = ActorManager.Instance.GetPlayer(hit_player_id);

                    if (src_player == null || hitPlayer == null || src_player.GetActorMono() == null || hitPlayer.GetActorMono() == null)
                    {
                        GameDebug.Log("player is null");
                    }
                    else
                    {
                        BulletTrackInstance sub_bullet_trace = new xc.BulletTrackInstance(m_BulletInfo, m_SkillInfo, 0);
                        m_TraceInsts.Add(sub_bullet_trace);

                        // 开启新的BulletTrackInstance
                        sub_bullet_trace.Do(m_SubEmitId, src_player.GetActorMono(), hitPlayer.GetActorMono(), mHideEffect, src_player.transform.position, src_player.transform.rotation, src_player.transform.forward, OnHit);

                        // 将伤害信息添加到新创建的SkillAttackInstance列表中
                        SkillAttackInstance attack_inst = EffectManager.GetInstance().GetAttackInstance(m_SubEmitId);
                        if (attack_inst != null)
                        {
                            Damage dmgInfo = null;
                            if (m_DamageInfos.TryGetValue(hit_player_id, out dmgInfo))
                            {
                                attack_inst.AddHurtInfo(dmgInfo);
                            }
                        }

                        m_HitEmits[hit_player_id] = new HitCacheInfo(m_SubEmitId);
                        m_SubEmitId++;
                    }

                    mLastThunderPlayer = hit_player_id;
                    HitPlayers.RemoveAt(0);
                }
                else// 此时表示闪电链的攻击结束了
                {
                    Destroy();
                }
            }
        }
示例#4
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;
        }