-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve cyclical reference issue and support map transitioning
- Loading branch information
Showing
8 changed files
with
67 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
extends Node | ||
|
||
# | ||
#@onready var current_scene: Node = $CurrentScene | ||
# | ||
# | ||
#func _ready() -> void: | ||
#Messenger.transition_root_scene.connect(_on_transition_root_scene) | ||
# | ||
# | ||
#func _on_transition_root_scene(scene: PackedScene) -> void: | ||
#var next_scene := scene.instantiate() | ||
#var prev_scene := current_scene.get_child(0) | ||
#if prev_scene: | ||
#prev_scene.queue_free() | ||
# | ||
#current_scene.add_child(next_scene) | ||
|
||
@onready var current_scene: Node = $CurrentScene | ||
|
||
|
||
func _ready() -> void: | ||
Messenger.transition_scene.connect(_on_transition_root_scene) | ||
|
||
|
||
func _on_transition_root_scene(scene: PackedScene) -> void: | ||
var next_scene := scene.instantiate() | ||
var prev_scene := current_scene.get_child(0) | ||
if prev_scene: | ||
prev_scene.queue_free() | ||
|
||
current_scene.add_child(next_scene) | ||
Messenger.transitioned_scene.emit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
extends Node | ||
|
||
signal closed_child_map(child: Map) | ||
signal transition_scene(scene: PackedScene) | ||
signal transitioned_scene |