new Player(name, number)
A Player class
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The player's name. |
number |
int | The player's number. |
Extends
Methods
(abstract) addItems(items)
Add items to a player
This is used by the trade (but could be used elsewhere as well)
Parameters:
Name | Type | Description |
---|---|---|
items |
Dictionary | a dictionary of items to be added to the player |
moveTo(position)
Represents a Player.
Parameters:
Name | Type | Description |
---|---|---|
position |
int | The new position (index on the board) to move the player to |
sendMessage(message) → {void}
Method to broadcast a message out to the other components
Parameters:
Name | Type | Description |
---|---|---|
message |
string | Message to send |
- Inherited From:
- Source:
Returns:
- Type
- void
subscribe(callback) → {void}
Method to subscribe to messages
Parameters:
Name | Type | Description |
---|---|---|
callback |
func | A callback method to pass the message to |
- Inherited From:
- Source:
Returns:
- Type
- void