Add removePlayers method to cleanly remove all players from the team.
This commit is contained in:
parent
d36319e35b
commit
187596ae3a
1 changed files with 22 additions and 1 deletions
|
|
@ -37,6 +37,27 @@ export class Team {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all players from the team.
|
||||||
|
*/
|
||||||
|
public removePlayers() {
|
||||||
|
|
||||||
|
// Reset the writer
|
||||||
|
if (this.writer) {
|
||||||
|
this.writer.team = null;
|
||||||
|
this.writer.role = null;
|
||||||
|
this.writer = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Reset all the guessers
|
||||||
|
for (var player of this.guessers) {
|
||||||
|
player.team = null;
|
||||||
|
player.role = null;
|
||||||
|
}
|
||||||
|
this.guessers = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets all the per-game data related to this team
|
* Resets all the per-game data related to this team
|
||||||
*/
|
*/
|
||||||
|
|
@ -44,7 +65,7 @@ export class Team {
|
||||||
this._hand.guesser = [];
|
this._hand.guesser = [];
|
||||||
this._questions = [];
|
this._questions = [];
|
||||||
this._answers = new Array<string>(8).fill(``);
|
this._answers = new Array<string>(8).fill(``);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue