Exemplo n.º 1
0
        /**
         * Adds a player to the client list, effectively making them part of the game
         * @param player the player to be added
         */
        static void AddNewPlayer(Player player)
        {
            Room r;

            //get random room if they're a new player
            if (player.RoomIndex == -1 || player.RoomIndex > Dungeon.GetRoomList().Count)
            {
                r = Dungeon.GetRandomRoom();
            }
            else
            {
                r = Dungeon.GetRoomList()[player.RoomIndex];
            }

            //add to the required stuffs
            player.SetRoom(r.RoomIndex);
            sqlWrapper.UpdatePlayerPos(player);
            clientList.Add(player);
        }