End of lesson 18 The command processor, Chapter 5
This commit is contained in:
13
scripts/game/commands/Command.gd
Normal file
13
scripts/game/commands/Command.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
class_name Command
|
||||
|
||||
signal COMMAND_PROCESSED(label)
|
||||
|
||||
var commandLabel
|
||||
|
||||
|
||||
func execute():
|
||||
COMMAND_PROCESSED.emit(commandLabel)
|
||||
|
||||
|
||||
func getCommandText():
|
||||
return commandLabel
|
||||
1
scripts/game/commands/Command.gd.uid
Normal file
1
scripts/game/commands/Command.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b4ee6hsxy7qwc
|
||||
5
scripts/game/commands/CommandDispatcher.gd
Normal file
5
scripts/game/commands/CommandDispatcher.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends Node
|
||||
|
||||
signal PROCESS_COMMAND(command)
|
||||
signal WAIT_FOR_COMMAND
|
||||
signal PAUSE_PROCESSOR
|
||||
1
scripts/game/commands/CommandDispatcher.gd.uid
Normal file
1
scripts/game/commands/CommandDispatcher.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://buuwlxv16l2lu
|
||||
10
scripts/game/commands/PassCommand.gd
Normal file
10
scripts/game/commands/PassCommand.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
extends Command
|
||||
|
||||
class_name PassCommand
|
||||
|
||||
func _init() -> void:
|
||||
commandLabel = "Pass"
|
||||
|
||||
func execute():
|
||||
print("Player passed.")
|
||||
COMMAND_PROCESSED.emit(commandLabel)
|
||||
1
scripts/game/commands/PassCommand.gd.uid
Normal file
1
scripts/game/commands/PassCommand.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://1a8ulyob7ld5
|
||||
Reference in New Issue
Block a user