19 lines
408 B
JavaScript
19 lines
408 B
JavaScript
export default class Player {
|
|
constructor() {
|
|
this.inventory = [];
|
|
this.currentRoom = "start";
|
|
this.context = null;
|
|
}
|
|
|
|
addItem(id) {
|
|
this.inventory.push(id);
|
|
}
|
|
|
|
removeItem(id) {
|
|
this.inventory = this.inventory.filter((item) => item != id);
|
|
}
|
|
|
|
getInventory() {
|
|
return this.inventory.map((item) => this.context.getItem(item));
|
|
}
|
|
} |