Exemplo n.º 1
0
        void HandleKillActor(S2CNwarUnitDead kDeathMsg)
        {
            if (!mIsRecvMsg)
            {
                return;
            }

            bool has_trigger         = false;
            SkillAttackInstance inst = EffectManager.GetInstance().GetAttackInstance(kDeathMsg.em_id);

            if (inst != null)
            {
                // 需要从伤害信息中获取攻击者(此处要求服务端的伤害消息一定在死亡消息之前发送)
                Actor src = ActorManager.Instance.GetActor(inst.SrcActorID);
                if (src != null && src.Trans != null && mOwner.Trans != null)
                {
                    has_trigger = true;

                    Vector3 vec = mOwner.Trans.position - src.Trans.position;
                    vec.y = 0;
                    vec.Normalize();
                    // 设置击飞方向信息
                    SkillAttackInstance.DeathAppendInfo info = new SkillAttackInstance.DeathAppendInfo();
                    info.Id     = kDeathMsg.id;
                    info.FlyDir = vec;
                    inst.AddDeathInfo(info);
                }
            }

            if (has_trigger == false)
            {
                mOwner.ActorMachine.DeathFlyInfo = new ActorMachine.DeathInfo();
                mOwner.Kill();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加命中的死亡数据
        /// </summary>
        public void AddDeathInfo(SkillAttackInstance.DeathAppendInfo death_info)
        {
            m_DeathAppendInfos[death_info.Id] = death_info;

            HitCacheInfo info;

            if (m_HitEmits.TryGetValue(death_info.Id, out info))
            {
                SkillAttackInstance attack_inst = EffectManager.GetInstance().GetAttackInstance(info.SubEmitID);
                if (attack_inst != null)
                {
                    attack_inst.AddDeathInfo(death_info);
                }
            }
        }