Exemple #1
0
    private void Update()
    {
        if (GameState == GameStates.Lobby)
        {
            foreach (var player in Server.Players)
            {
                if (LobbyManager.ContainsPlayer(player))
                {
                    LobbyManager.UpdatePlayer(player);
                }
                else
                {
                    LobbyManager.AddPlayer(player);
                }
            }

            var removePlayer = LobbyManager.GetDisconnectedPlayer(Server.Players);
            foreach (var player in removePlayer)
            {
                LobbyManager.RemovePlayer(player);
            }
        }
        else
        {
            foreach (var item in Server.Players)
            {
                var a = _playerAchievements[item];

                if (a.IsAchieved())
                {
                    var cmd = new Command(item, "MISSION", a.Name + "\n" + a.Description + ";SUCC");
                    Server.SendPlayerMessage(item, cmd);

                    a = Achievements.GetNextAchievement(item.Id, a);
                    _playerAchievements[item] = a;

                    cmd = new Command(item, "MISSION", a.Name + "\n" + a.Description);
                    Server.SendPlayerMessage(item, cmd);
                }
            }
        }
    }