state chart additions: consumed events export and auto_initialize toggle

This commit is contained in:
Haze Weathers 2023-05-02 13:13:49 -04:00
parent 941f8f0f09
commit 79cbd62a69
2 changed files with 13 additions and 1 deletions

View file

@ -2,6 +2,8 @@ tool
class_name StateChart, "state_chart.svg"
extends Node
## whether chart should initialize on its own or be done manually
export var auto_initialize: bool = true
## whether chart should propagate processing events every frame
export var idle_frame_event: bool = false
export var physics_frame_event: bool = false
@ -15,7 +17,10 @@ var _guard_properties: Dictionary = {}
func _ready() -> void:
if Engine.editor_hint:
return
if auto_initialize:
initialize()
func initialize() -> void:
# make sure only one child exists
if get_child_count() != 1:
push_error("StateChart must have exactly one child")