12345678910111213141516171819202122232425262728293031323334 |
- /// <reference path="../Thing.ts" />
- /// <reference path="../Room.ts" />
- /**
- * Maps can hold information of certain rooms or a region.
- * If a player has a map, all the rooms in the map are always remembered.
- */
- class MapNote extends Thing {
- public rooms : Array<Room> = [];
- public regions : Array<Region> = [];
- public addRoom (...rooms : Array<Room>) {
- rooms.forEach((room) => {
- this.rooms.push(room);
- });
- }
- public addRegion (...regions : Array<Region>) {
- regions.forEach(region => {
- this.regions.push(region);
- });
- }
- public contains (room : Room) {
- if(this.rooms.indexOf(room) != -1) {
- return true;
- } else {
- for (var i = 0; i < this.regions.length; i++) {
- if (this.regions[i].getRooms().indexOf(room) != -1) {
- return true;
- }
- }
- }
- }
- }
|