Created
July 30, 2016 14:37
-
-
Save JeremyLikness/80cc8531c1f337bfe6c5301f6606b4ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Directions } from './directions'; | |
| import { Thing } from './thing'; | |
| export class Room { | |
| public directions: Room[] = [null, null, null, null]; | |
| public walls: Directions[] = []; | |
| public name: string = ''; | |
| public description: string = ''; | |
| public idx: number = -1; | |
| public visited: boolean = false; | |
| public static setIds(rooms: Room[]): void { | |
| for (let idx = 0; idx < rooms.length; idx += 1) { | |
| rooms[idx].idx = idx; | |
| } | |
| } | |
| public get longDescription(): string { | |
| let text = this.name + ': ' + this.description + '\r\n'; | |
| // ... etc. | |
| return text; | |
| } | |
| public setDirection(dir: Directions, room: Room): void { | |
| this.directions[dir] = room; | |
| } | |
| public getDirection(dir): Room { | |
| return this.directions[dir]; | |
| } | |
| public get north(): Room { | |
| return this.directions[Directions.North]; | |
| } | |
| // ... etc. | |
| public things: Thing[] = []; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment