コード例 #1
0
        // ========================================================================
        // =========================== UPDATES (MULTIPLAYER) ======================
        // ========================================================================

        private void UpdatePlayers(ServerGameState stateDTO)
        {
            foreach (var dto in stateDTO.Players)
            {
                Player player = PlayerRepository.Players.Find(p => p.Name.Equals(dto.Name));
                if (player != null && !MainPlayer.Equals(player))
                {
                    player.RefreshData(dto);
                }

                if (player == null)
                {
                    Player tmpPlayer = new Player(dto);
                    PlayerRepository.Players.Add(tmpPlayer);
                }
            }
        }