Initial game class.
This commit is contained in:
parent
169105f400
commit
661f52292e
1 changed files with 22 additions and 0 deletions
22
src/utils/Game.ts
Normal file
22
src/utils/Game.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
class Game {
|
||||
readonly code: string;
|
||||
#_players: players;
|
||||
|
||||
public constructor(code: string, host: string) {
|
||||
this.code = code;
|
||||
this.#_players = {};
|
||||
this.add_player(host, true);
|
||||
};
|
||||
|
||||
get players(): players {
|
||||
return this.#_players;
|
||||
};
|
||||
|
||||
public add_player(player: string, is_host:boolean=false): void {
|
||||
this.#_players[player] = {
|
||||
position: undefined,
|
||||
role: undefined,
|
||||
host: is_host
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue