Constructor
new Room(roomId, roomMembers, maxPlayersPerRoom)
Parameters:
Name | Type | Description |
---|---|---|
roomId |
string | unique room id assigned on room creation, the id is generated using uuid() module |
roomMembers |
Array.<Player> | array of players in the room |
maxPlayersPerRoom |
integer | maximum players per room, must be greater than 1 |
- Source:
Methods
addPlayer(player)
Parameters:
Name | Type | Description |
---|---|---|
player |
Player | Player object, representing the player to be added to the room |
- Source:
broadcastGameFlowEvent(Lobby, Event, senderId)
Parameters:
Name | Type | Description |
---|---|---|
Lobby |
Lobby | Lobby object, A Lobby is where all the rooms and the players' connections are stored , Think of a Lobby as the place where all the players hangout before they are matched to a room |
Event |
Event | Event object, representing the event to be broadcasted from the sender to the sender's room |
senderId |
string | the playerId of the sender, a playerId is a unique player id assigned once the connection is established using uuid package |
- Source:
broadcastGamePlayEvent(Lobby, gamePlayEvent, senderId)
Parameters:
Name | Type | Description |
---|---|---|
Lobby |
Lobby | Lobby object, A Lobby is where all the rooms and the players' connections are stored , Think of a Lobby as the place where all the players hangout before they are matched to a room |
gamePlayEvent |
GamePlayEvent | GamePlayEvent object, representing the gamePlayEvent to be broadcasted from the sender to the sender's room |
senderId |
string | the playerId of the sender, a playerId is a unique player id assigned once the connection is established using uuid package |
- Source:
removePlayer(playerId)
Parameters:
Name | Type | Description |
---|---|---|
playerId |
string | unique player id assigned once the connection is established using uuid package |
- Source: