Skip to content

Instantly share code, notes, and snippets.

@JeremyLikness
Created July 30, 2016 14:37
Show Gist options
  • Select an option

  • Save JeremyLikness/80cc8531c1f337bfe6c5301f6606b4ec to your computer and use it in GitHub Desktop.

Select an option

Save JeremyLikness/80cc8531c1f337bfe6c5301f6606b4ec to your computer and use it in GitHub Desktop.
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