feat: add helper function in RMG

This commit is contained in:
Renge 2022-04-06 22:11:52 -04:00
parent 1b6bbf8444
commit 0b98b964bd

View File

@ -176,6 +176,19 @@ export default class RandomMapGenerator {
return Facing.DOWN; return Facing.DOWN;
} }
private getOppositeFacing(facing: Facing): Facing {
switch (facing) {
case Facing.LEFT:
return Facing.RIGHT;
case Facing.RIGHT:
return Facing.LEFT;
case Facing.UP:
return Facing.DOWN;
case Facing.DOWN:
return Facing.UP;
}
}
private getRandomRoom(value: number, facing: Facing): RoomTemplate { private getRandomRoom(value: number, facing: Facing): RoomTemplate {
let array = this.getRoomArray(facing), weight = this.getRoomWeight(facing); let array = this.getRoomArray(facing), weight = this.getRoomWeight(facing);