예제 #1
0
        private void GlobalEventManager_onClientDamageNotified(RoR2.DamageDealtMessage obj)
        {
            if (!obj.victim)
            {
                return;
            }

            if (_rewarding.Value)
            {
                Reward(obj);
            }

            if(_punishing.Value)
            {
                Punishing(obj);
            }
        }
        private static void HandleDamageDealt(NetworkMessage netMsg)
        {
            DamageDealtMessage damageDealtMessage = netMsg.ReadMessage <DamageDealtMessage>();

            if (damageDealtMessage.victim)
            {
                HealthComponent component = damageDealtMessage.victim.GetComponent <HealthComponent>();
                if (component && !NetworkServer.active)
                {
                    component.UpdateLastHitTime(damageDealtMessage.damage, damageDealtMessage.position, damageDealtMessage.isSilent);
                }
            }
            if (RoR2Application.enableDamageNumbers.value && DamageNumberManager.instance)
            {
                TeamComponent teamComponent = null;
                if (damageDealtMessage.attacker)
                {
                    teamComponent = damageDealtMessage.attacker.GetComponent <TeamComponent>();
                }
                DamageNumberManager.instance.SpawnDamageNumber(damageDealtMessage.damage, damageDealtMessage.position, damageDealtMessage.crit, teamComponent ? teamComponent.teamIndex : TeamIndex.None, damageDealtMessage.damageColorIndex);
            }
            GlobalEventManager.ClientDamageNotified(damageDealtMessage);
        }