-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add barebones room transition functionality
- Loading branch information
Showing
7 changed files
with
119 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default class Vocabulary { | ||
private static directionalActions = []; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export class Atmosphere { | ||
readonly color: string; | ||
private static instances: Map<string, Atmosphere> = new Map<string, Atmosphere>([ | ||
['dark', new Atmosphere({ color: '#232323' })], | ||
['wooden', new Atmosphere({color: 'brown'})] | ||
]); | ||
|
||
protected constructor({color}: {color: string}) { | ||
this.color = color; | ||
} | ||
|
||
public get(mood: string): Atmosphere | undefined { | ||
return Atmosphere.instances.get(mood); | ||
} | ||
} | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Room from './Room'; | ||
|
||
export default class Transition { | ||
readonly from: Room; | ||
readonly to: Room; | ||
_blocked: boolean; | ||
readonly description?: string; | ||
readonly aliases: string[]; | ||
readonly actions: string[]; | ||
|
||
constructor({ | ||
from, | ||
to, | ||
actions, | ||
aliases, | ||
description, | ||
blocked | ||
}: { | ||
from: Room; | ||
to: Room; | ||
actions: string[] | ||
aliases: string[] | ||
description?: string; | ||
blocked?: boolean; | ||
}) { | ||
this.from = from; | ||
this.to = to; | ||
this.aliases = aliases; | ||
this.description = description; | ||
this._blocked = blocked || false; | ||
this.actions = actions; | ||
} | ||
|
||
set blocked(blocked: boolean) { | ||
this._blocked = blocked; | ||
} | ||
|
||
get blocked() { | ||
return this._blocked; | ||
} | ||
} |
This file contains 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
This file contains 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