35 lines
602 B
GDScript
35 lines
602 B
GDScript
extends Node
|
|
|
|
|
|
var state_stack = []
|
|
|
|
func _ready():
|
|
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())
|
|
|
|
func update_oya():
|
|
yield()
|
|
print("update oya")
|
|
yield()
|
|
|
|
func update_game():
|
|
print("update game")
|