private void OnMineDamage(IComponentEvent obj)
    {
        MineDamage mineDamage = obj as MineDamage;

        OnMineFracture(mineDamage.HitCollider, mineDamage.Damage);
    }
Пример #2
0
    /// <summary>
    /// 技能命中效果
    /// </summary>
    /// <param name="buf"></param>
    private void OnSkillEffect_ServerMessage(IComponentEvent componentEvent)
    {
        S2C_SKILL_EFFECT_Event respond = componentEvent as S2C_SKILL_EFFECT_Event;

        uint MainID = m_GameplayProxy.GetMainPlayerUID();

        SpacecraftEntity caster = m_GameplayProxy.GetEntityById <SpacecraftEntity>(respond.msg.wCasterID) as SpacecraftEntity;
        SpacecraftEntity target = m_GameplayProxy.GetEntityById <SpacecraftEntity>(respond.msg.wTargetHeroID) as SpacecraftEntity;

        if ((caster != null && caster.IsMain()) ||
            (target != null && target.IsMain()) ||
            (caster != null && caster.GetEntityFatherOwnerID() == MainID) ||
            (target != null && target.GetEntityFatherOwnerID() == MainID)
            )
        {
            SkillHurtInfo hurtInfo = MessageSingleton.Get <SkillHurtInfo>();
            hurtInfo.TargetID          = respond.msg.wTargetHeroID;
            hurtInfo.IsCrit            = respond.msg.crit_type != 0;
            hurtInfo.PenetrationDamage = (int)respond.msg.PenetrationDamage;
            hurtInfo.IsDodge           = respond.msg.isdoge != 0;
            hurtInfo.EffectID          = (int)(respond.msg.byAttackEvent == (byte)EffectType.TriggerAnomaly ? respond.msg.wTriggerID : 0);
            hurtInfo.IsWeak            = respond.msg.crit_type == 3;

            for (int iDamage = 0; iDamage < respond.msg.count; iDamage++)
            {
                hurtInfo.Damage = (int)(respond.msg.wDamage / respond.msg.count);
                GameFacade.Instance.SendNotification(NotificationName.SkillHurt, hurtInfo);
            }

            // 采矿的表现 (矿物碎裂)
            SpacecraftEntity currentTargetEntity = m_Property.GetTarget();
            if (currentTargetEntity != null && currentTargetEntity.GetHeroType() == KHeroType.htMine && caster.GetTargetCollider() != null)
            {
                MineDamage mineEvent = new MineDamage();
                mineEvent.HitCollider = caster.GetTargetCollider();
                mineEvent.Damage      = respond.msg.wDamage;
                currentTargetEntity.SendEvent(ComponentEventName.MineDamage, mineEvent);
            }
        }

        if (target && target.IsMain())
        {
            if (m_Property.GetUnderAttackWarningToneCountdown() == 0)
            {
                WwiseUtil.PlaySound(WwiseManager.voiceComboID, WwiseMusicSpecialType.SpecialType_Voice_Be_Attacked, WwiseMusicPalce.Palce_1st, false, null);
            }

            float countDown = m_CfgEternityProxy.GetGamingConfig(1).Value.Sound.Value.CountDown.Value.UnderAttackWarningTone;
            m_Property.SetUnderAttackWarningToneCountdown(countDown);
        }

        /// 播放弱点攻击声音提示
        /// TODO.crit_type暂时没有枚举
        if (caster && caster.IsMain())
        {
            if (m_WeakSoundTmpCD >= m_WeakSoundCD && respond.msg.crit_type == 3)
            {
                float val = Random.value;
                if (val <= m_WeakSoundProbability)
                {
                    SendEvent(ComponentEventName.PlayVideoSound, new PlayVideoSound()
                    {
                        GroupID = (int)m_CfgEternityProxy.GetGamingConfig(1).Value.Mine.Value.Sound.Value.WeaknessSoundVideo
                    });
                    m_WeakSoundTmpCD = 0;
                }
            }
        }
    }