CommandLibrary
Class: CommandLibrary
Defined in: commandLibrary.ts:59
CommandLibrary contains a HashMap that: Can be called by CommandMapper. Maps a String command to the corresponding GameCommand.
Constructors
Constructor
new CommandLibrary():
CommandLibrary
Defined in: commandLibrary.ts:64
Returns
CommandLibrary
Methods
add()
add(
command):boolean
Defined in: commandLibrary.ts:83
Add a command (returns false if name already exists)
Parameters
| Parameter | Type | 
|---|---|
command | GameCommand | 
Returns
boolean
clear()
clear():
void
Defined in: commandLibrary.ts:113
Clear all commands
Returns
void
get()
get(
name):undefined|GameCommand
Defined in: commandLibrary.ts:103
Get a command by name
Parameters
| Parameter | Type | 
|---|---|
name | string | 
Returns
undefined | GameCommand
has()
has(
name):boolean
Defined in: commandLibrary.ts:98
Check if a command exists
Parameters
| Parameter | Type | 
|---|---|
name | string | 
Returns
boolean
list()
list():
GameCommand[]
Defined in: commandLibrary.ts:108
List all commands
Returns
remove()
remove(
name):boolean
Defined in: commandLibrary.ts:93
Remove a command by name
Parameters
| Parameter | Type | 
|---|---|
name | string | 
Returns
boolean
getInstance()
staticgetInstance():CommandLibrary
Defined in: commandLibrary.ts:71
Returns
CommandLibrary
The singleton instance of CommandLibrary.