Exemplo n.º 1
0
        public bool AddMap(int playerKey, short[][] map)
        {
            int playerId = GetPlayerRoomId(playerKey);

            if (playerId == -1)
            {
                return(false);
            }

            if (GameOn)
            {
                return(false);
            }

            ShipsMap shipsMap = new ShipsMap(map, MapSize, ShipList);

            if (!shipsMap.ValidateMap())
            {
                return(false);
            }

            Maps[playerId] = shipsMap;

            if (Maps[0] != null && Maps[1] != null)
            {
                GameOn = true;
            }

            return(true);
        }
Exemplo n.º 2
0
        public GameRoom(int roomID, string roomName, short mapsize, short[] shipList)
        {
            RoomID   = roomID;
            RoomName = roomName;
            MapSize  = mapsize;
            ShipList = shipList;

            CurrentPlayerTurn = 0;

            RoomPlayersKeys  = new List <int>(2);
            PlayersNames     = new List <string>(2);
            PlayerDatabaseId = new List <string>(2);
            Maps             = new ShipsMap[2];
        }