Example #1
0
 /// <summary>
 /// 处理技能伤害
 /// </summary>
 /// <param name="info">SkillHurtInfo</param>
 private void OnSkillHurt(SkillHurtInfo info)
 {
     if (info == null)
     {
         return;
     }
     //弱点攻击
     if (info.IsWeak && info.Damage != 0 && !info.IsCrit)
     {
         AddNumber(info.TargetID, string.Format(TableUtil.GetLanguageString("damage_number_id_1009"), info.Damage), "hurtweak");
     }
     //普通伤害
     if (info.Damage != 0 && !info.IsCrit && !info.IsWeak)
     {
         AddNumber(info.TargetID, string.Format(TableUtil.GetLanguageString("damage_number_id_1001"), info.Damage), "normal");
     }
     //暴击伤害
     if (info.Damage != 0 && info.IsCrit)
     {
         AddNumber(info.TargetID, string.Format(TableUtil.GetLanguageString("damage_number_id_1002"), info.Damage), "crit");
     }
     //穿透伤害
     if (info.PenetrationDamage != 0)
     {
         AddNumber(info.TargetID, string.Format(TableUtil.GetLanguageString("damage_number_id_1003"), info.PenetrationDamage), "penetration");
     }
     //闪避
     if (info.IsDodge)
     {
         AddNumber(info.TargetID, string.Format(TableUtil.GetLanguageString("damage_number_id_1004")), "miss");
     }
     //效果
     if (info.EffectID != 0)
     {
         //AddNumber(info.TargetID, string.Format(TableUtil.GetLanguageString("damage_number_id_1005"), info.EffectID), "effect");
     }
 }
Example #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;
                }
            }
        }
    }