systeme_solaire.gd 727 B

123456789101112131415161718192021222324252627
  1. extends Node
  2. @onready var choix_niveau: Node = find_parent("ChoixNiveau")
  3. func _ready() -> void:
  4. _connecter_choix_niveau()
  5. _focus_premier_niveau()
  6. func _notification(recue: int) -> void:
  7. if NOTIFICATION_UNPAUSED == recue:
  8. _focus_premier_niveau()
  9. func _connecter_choix_niveau() -> void:
  10. for child in get_children():
  11. assert(child is Planete, "Seules les planetes sont autorisees dans le systeme")
  12. var planete: Planete = child as Planete
  13. planete.niveau_choisi.connect(choix_niveau.demarrer_niveau)
  14. func _focus_premier_niveau() -> void:
  15. assert(get_child_count() > 0, "Au moins un niveau doit exister dans le jeu")
  16. var premier_niveau: Planete = get_children().front() as Planete
  17. premier_niveau.grab_focus()