2021-11-04 19:58:37 +00:00
|
|
|
export default class Player {
|
|
|
|
constructor() {
|
|
|
|
this.inventory = [];
|
|
|
|
this.currentRoom = "start";
|
2021-11-04 21:47:09 +00:00
|
|
|
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));
|
2021-11-04 19:58:37 +00:00
|
|
|
}
|
|
|
|
}
|