2021-12-06 23:10:39 +01:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
|
2021-12-12 23:21:03 +01:00
|
|
|
var state_stack = []
|
2021-12-06 23:10:39 +01:00
|
|
|
|
|
|
|
func _ready():
|
2021-12-12 23:21:03 +01:00
|
|
|
state_stack.push_back(funcref(self, "update_game"))
|
|
|
|
state_stack.push_back(funcref(self, "update_oya"))
|
|
|
|
|
|
|
|
func _process(delta):
|
|
|
|
if state_stack.empty():
|
|
|
|
return
|
|
|
|
|
|
|
|
var state = state_stack.pop_back()
|
|
|
|
if state == null:
|
|
|
|
return
|
|
|
|
|
|
|
|
if state is FuncRef:
|
|
|
|
state_stack.push_back(state.call_func())
|
|
|
|
return
|
|
|
|
|
|
|
|
if not (state is GDScriptFunctionState and state.is_valid()):
|
|
|
|
printerr("Invalid state")
|
|
|
|
return
|
|
|
|
|
|
|
|
state_stack.push_back(state.resume())
|
2021-12-06 23:10:39 +01:00
|
|
|
|
2021-12-12 23:21:03 +01:00
|
|
|
func update_oya():
|
|
|
|
yield()
|
|
|
|
print("update oya")
|
|
|
|
yield()
|
2021-12-06 23:10:39 +01:00
|
|
|
|
2021-12-12 23:21:03 +01:00
|
|
|
func update_game():
|
|
|
|
print("update game")
|