Exemple #1
0
        public void OnHurt(int dmg)
        {
            BoltLog.Warn($"player {playerId} get hurt for {dmg}");
            health -= dmg;

            var dmgEvent = OnDamaged.Create(entity, EntityTargets.OnlyController);

            dmgEvent.TargetID = Convert.ToInt32(playerId);
            dmgEvent.Dmg      = dmg;
            dmgEvent.Send();

            if (health > 0)
            {
                return;
            }
            OnPlayerDeath.Post(GlobalTargets.AllClients, playerId);
            PlayerRegistry.RemovePlayer(Convert.ToUInt32(playerId));
        }