Exemplo n.º 1
0
    /// <summary>
    /// 同步HP、MP
    /// </summary>
    /// <param name="buf"></param>
    private void OnHeroHpMpAnger(KProtoBuf buf)
    {
        S2C_SYNC_HERO_HPMP_ANGER msg    = buf as S2C_SYNC_HERO_HPMP_ANGER;
        SpacecraftEntity         entity = m_GameplayProxy.GetEntityById <SpacecraftEntity>(msg.heroID);

        if (entity != null)
        {
            entity.SetAttribute(AttributeName.kHP, msg.hp);
            entity.SetAttribute(AttributeName.kShieldValue, msg.shield_value);
            entity.SetAttribute(AttributeName.kPowerValue, msg.energyPower);
            //新屬性目前沒有
            //entity.SetAttribute(AttributeName.DefenseShield, msg.defense_shield_value);
            //entity.SetAttribute(AttributeName.ManaShield, msg.mana_shield_value);
            //entity.SetAttribute(AttributeName.SuperMagnetic, msg.superMagnetic);

            double oldPeerless = entity.GetAttribute(AttributeName.kConverterValue);             /// entity.GetPeerless();
            /// entity.SetPeerless((uint)msg.current_peerless);
            entity.SetAttribute(AttributeName.kConverterValue, msg.current_peerless);

            if (entity.IsMain() && oldPeerless != entity.GetAttribute(AttributeName.kConverterMax) &&
                entity.GetAttribute(AttributeName.kConverterValue) == entity.GetAttribute(AttributeName.kConverterMax))
            {
                entity.SendEvent(ComponentEventName.MaxPeerlessReached, null);
            }
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 技能治疗效果
    /// </summary>
    /// <param name="buf"></param>
    private void OnSkillHealEffect_ServerMessage(IComponentEvent componentEvent)
    {
        S2C_HEAL_EFFECT_Event respond = componentEvent as S2C_HEAL_EFFECT_Event;

        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()))
        {
            BuffHurtInfo hurtInfo = MessageSingleton.Get <BuffHurtInfo>();
            hurtInfo.targetID = respond.msg.wTargetHeroID;
            hurtInfo.type     = (EffectType)respond.msg.Healtype;
            hurtInfo.value    = (int)respond.msg.wHealValue;
            GameFacade.Instance.SendNotification(NotificationName.BuffHurt, hurtInfo);
        }
    }
Exemplo n.º 3
0
    private void OnSkillEffect(IComponentEvent componentEvent)
    {
        S2C_SKILL_EFFECT_Event respond = componentEvent as S2C_SKILL_EFFECT_Event;

        SpacecraftEntity caster  = m_GameplayProxy.GetEntityById <SpacecraftEntity>(respond.msg.wCasterID) as SpacecraftEntity;
        SpacecraftEntity target  = m_GameplayProxy.GetEntityById <SpacecraftEntity>(respond.msg.wTargetHeroID) as SpacecraftEntity;
        Camera           mainCam = CameraManager.GetInstance().GetMainCamereComponent()?.GetCamera();

        if (caster != null && target != null && target.IsMain() && mainCam != null)
        {
            Vector3 targetToAttacker          = caster.GetRootTransform().position - target.GetRootTransform().position;
            AttackWarningDirection warningDir = GetAttackDirection(targetToAttacker);

            Debug.LogFormat("HitWarning | SKillEffect. {0}", warningDir);

            EffectController hitWarningFX = EffectManager.GetInstance().CreateEffect(m_WarningMap[warningDir], EffectManager.GetEffectGroupNameInSpace(true));
            hitWarningFX.transform.SetParent(m_Property.GetSkinRootTransform(), false);
        }
    }
Exemplo n.º 4
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;
                }
            }
        }
    }