Vast improvements and a working finite state machine, working on new guild member registration.
This commit is contained in:
34
fsm/nodes/wait.gd
Normal file
34
fsm/nodes/wait.gd
Normal file
@@ -0,0 +1,34 @@
|
||||
extends StateNode
|
||||
|
||||
|
||||
@export var wait_duration : float = 1
|
||||
var wait_remaining : float = 0
|
||||
var next_state : String
|
||||
var next_state_args : Array = []
|
||||
var actor
|
||||
func exit() -> void:
|
||||
actor.show_speech_bubble("")
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if wait_remaining > 0:
|
||||
wait_remaining -= delta
|
||||
if wait_remaining <= 0:
|
||||
wait_remaining = 0
|
||||
complete_state()
|
||||
|
||||
func execute(subject, ...args : Array) -> void:
|
||||
wait_remaining = wait_duration
|
||||
actor = subject
|
||||
|
||||
if len(args) > 0 and args[0] != "":
|
||||
subject.show_speech_bubble(args[0])
|
||||
|
||||
if len(args) > 1 and args[1] != "":
|
||||
next_state = args[1]
|
||||
else:
|
||||
next_state = ""
|
||||
|
||||
if len(args) > 2 and args[2] != "":
|
||||
next_state_args = args[2]
|
||||
else:
|
||||
next_state_args = []
|
||||
Reference in New Issue
Block a user