Ejemplo n.º 1
0
        public static void InvokePlayerHurt(PlayerStats stats, ref PlayerStats.HitInfo hitInfo, GameObject player, int playerId = 0)
        {
            if (PlayerHurtEvent == null)
            {
                return;
            }

            PlayerHurtEvent ev = new PlayerHurtEvent
            {
                Attacker = playerId == 0 ? stats.gameObject.GetPlayer() : Player.GetPlayer(playerId),
                Player   = player.GetPlayer(),
                Info     = hitInfo
            };

            if (string.IsNullOrEmpty(ev.Player.GetUserId()))
            {
                return;
            }

            PlayerHurtEvent.InvokeSafely(ev);

            hitInfo = ev.Info;
        }
Ejemplo n.º 2
0
        public static void InvokePlayerHurt(PlayerStats stats, ref PlayerStats.HitInfo info, GameObject obj, int pid = 0)
        {
            PlayerHurt playerHurt = PlayerHurtEvent;

            if (playerHurt == null)
            {
                return;
            }

            PlayerHurtEvent ev = new PlayerHurtEvent
            {
                Attacker = pid == 0 ? stats.gameObject.GetPlayer() : Player.GetPlayer(pid),
                Player   = obj.GetPlayer(),
                Info     = info
            };

            if (string.IsNullOrEmpty(ev.Player.characterClassManager.UserId))
            {
                return;
            }
            playerHurt.Invoke(ref ev);
            info = ev.Info;
        }