doggo-quest-logic
Version:
The game logic for the Doggo Quest text-based game sample project
47 lines (46 loc) • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Room_1 = require("./Room");
const Crate_1 = require("./OfficeArea/Crate");
const Dining_1 = require("./KitchenArea/Dining");
const Entryway_1 = require("./KitchenArea/Entryway");
const Kitchen_1 = require("./KitchenArea/Kitchen");
const LivingRoom_1 = require("./LivingArea/LivingRoom");
const Office_1 = require("./OfficeArea/Office");
const OnChair_1 = require("./OfficeArea/OnChair");
const UnderCouch_1 = require("./LivingArea/UnderCouch");
class GameWorld {
constructor() {
this.score = 0;
this.currentRoom = Room_1.Room.InCrate;
this.isChairChewed = false;
this.foundCrumb = false;
this.ateCrumb = false;
this.timeAdvanced = 0;
this.isGameOver = false;
this.isCrateOpen = false;
this.rooms = [
new Office_1.Office(),
new OnChair_1.OnChair(),
new Crate_1.Crate(),
new Entryway_1.Entryway(),
new Dining_1.Dining(),
new LivingRoom_1.LivingRoom(),
new UnderCouch_1.UnderCouch(),
new Kitchen_1.Kitchen()
];
}
getRoom(room) {
return this.rooms.find(r => r.id === room);
}
reset() {
this.isCrateOpen = false;
this.currentRoom = Room_1.Room.InCrate;
this.timeAdvanced = 0;
this.isChairChewed = false;
this.ateCrumb = false;
this.score = 0;
this.isGameOver = false;
}
}
exports.GameWorld = GameWorld;