Example #1
0
        public void OnSetPlayerName(uint clientId, SetPlayerNameClientMessage clientClientMessage)
        {
            GameState.SetPlayerName(clientId, clientClientMessage.Name);
            Messenger.Broadcast(new SetPlayerNameServerMessage(clientId, clientClientMessage.Name));

            Logger.Log($"Player {clientId} set name: {clientClientMessage.Name}");
            GameServer.BroadCastTop();
        }
Example #2
0
        public void OnPlayerHit(uint clientId, PlayerHitClientMessage msg)
        {
            var hitterPlayer = GameState.GetPlayer(msg.PlayeId);

            if (hitterPlayer != null && hitterPlayer.Hp > 0)
            {
                var targetPlayer = GameState.HitPlayer(msg.PlayeId, msg.HitPoints, clientId);

                Messenger.Broadcast(new SetPlayerHpServerMessage(targetPlayer));

                if (targetPlayer.Hp == 0)
                {
                    Logger.Log(GameState.top);
                    GameServer.BroadCastTop();
                }
            }
        }