123456789101112131415161718192021222324252627 |
- class_name PromptContainer
- extends Control
- ## Free itself when no prompt remaining
- var _nb_prompts: int
- func _ready() -> void:
- _nb_prompts = 0
- for child in get_children():
- if child is InputPrompt:
- child.tree_exited.connect(_on_child_exited_tree)
- _nb_prompts += 1
- func remove_if_no_more_prompt():
- _nb_prompts -= 1
- print(_nb_prompts, " remaining prompts")
- if _nb_prompts <= 0:
- # Only label remaining
- print("Destruction !")
- queue_free()
- func _on_child_exited_tree() -> void:
- remove_if_no_more_prompt()
|