Moving files pre-refactor
This commit is contained in:
7
meta/InitialScene.tscn
Normal file
7
meta/InitialScene.tscn
Normal file
@@ -0,0 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bs41nqi3ocih3"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d2u7xxqmy8mws" path="res://ui/mainmenu/MainMenu.tscn" id="1_hu3pf"]
|
||||
|
||||
[node name="InitialScene" type="Node3D"]
|
||||
|
||||
[node name="MainMenu" parent="." instance=ExtResource("1_hu3pf")]
|
33
meta/OverworldScene.gd
Normal file
33
meta/OverworldScene.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
class_name OverworldScene extends Node
|
||||
|
||||
func _enter_tree() -> void:
|
||||
OVERWORLD.mapChanged.connect(onMapChanged)
|
||||
|
||||
func _ready() -> void:
|
||||
onMapChanged(OVERWORLD.newMap, OVERWORLD.playerDestinationNodeName)
|
||||
|
||||
func _exit_tree() -> void:
|
||||
OVERWORLD.mapChanged.disconnect(onMapChanged)
|
||||
|
||||
func onMapChanged(newMap:PackedScene, playerDestinationNodeName:String) -> void:
|
||||
print("New map time.")
|
||||
var map = $Map
|
||||
for childScene in map.get_children():
|
||||
map.remove_child(childScene)
|
||||
|
||||
if !newMap:
|
||||
return
|
||||
|
||||
var newMapInstance = newMap.instantiate()
|
||||
map.add_child(newMapInstance)
|
||||
|
||||
# Find Player.
|
||||
var player = newMapInstance.get_node("Player")
|
||||
var destNode = newMapInstance.get_node(playerDestinationNodeName)
|
||||
if player && player is Player && destNode:
|
||||
player.global_position = destNode.global_position
|
||||
player.global_rotation.y = destNode.global_rotation.y
|
||||
elif playerDestinationNodeName:
|
||||
push_error("Player, or destination node not found in new map.")
|
||||
|
||||
pass
|
1
meta/OverworldScene.gd.uid
Normal file
1
meta/OverworldScene.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dpvccegdmn7s6
|
8
meta/OverworldScene.tscn
Normal file
8
meta/OverworldScene.tscn
Normal file
@@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://c0k1t3tyiaojl"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dpvccegdmn7s6" path="res://meta/OverworldScene.gd" id="1_fa54r"]
|
||||
|
||||
[node name="OverworldScene" type="Node3D"]
|
||||
script = ExtResource("1_fa54r")
|
||||
|
||||
[node name="Map" type="Node3D" parent="."]
|
33
meta/RootScene.gd
Normal file
33
meta/RootScene.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
class_name RootScene extends Node3D
|
||||
|
||||
@export var overworld:Node3D = null
|
||||
@export var initial:Node3D = null
|
||||
|
||||
func _enter_tree() -> void:
|
||||
SCENE.sceneChanged.connect(onSceneChange)
|
||||
SCENE.setScene(SceneSingleton.SceneType.INITIAL)
|
||||
|
||||
func _exit_tree() -> void:
|
||||
push_error("RootScene should not be removed from the scene tree. This is a bug.")
|
||||
|
||||
func onSceneChange(newScene:SceneSingleton.SceneType) -> void:
|
||||
remove_child(overworld)
|
||||
remove_child(initial)
|
||||
|
||||
overworld.visible = false
|
||||
initial.visible = false
|
||||
|
||||
match newScene:
|
||||
SceneSingleton.SceneType.INITIAL:
|
||||
add_child(initial)
|
||||
initial.visible = true
|
||||
|
||||
SceneSingleton.SceneType.OVERWORLD:
|
||||
add_child(overworld)
|
||||
overworld.visible = true
|
||||
|
||||
SceneSingleton.SceneType.UNSET:
|
||||
pass
|
||||
|
||||
_:
|
||||
pass
|
1
meta/RootScene.gd.uid
Normal file
1
meta/RootScene.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ml70iui7qpo4
|
17
meta/RootScene.tscn
Normal file
17
meta/RootScene.tscn
Normal file
@@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://ckkewlcugc8ro"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ml70iui7qpo4" path="res://meta/RootScene.gd" id="1_nky1x"]
|
||||
[ext_resource type="PackedScene" uid="uid://bs41nqi3ocih3" path="res://meta/InitialScene.tscn" id="2_hkmoa"]
|
||||
[ext_resource type="PackedScene" uid="uid://c0k1t3tyiaojl" path="res://meta/OverworldScene.tscn" id="2_o1wvd"]
|
||||
|
||||
[node name="RootScene" type="Node3D" node_paths=PackedStringArray("overworld", "initial")]
|
||||
script = ExtResource("1_nky1x")
|
||||
overworld = NodePath("OverworldScene")
|
||||
initial = NodePath("InitialScene")
|
||||
metadata/_custom_type_script = "uid://ml70iui7qpo4"
|
||||
|
||||
[node name="InitialScene" parent="." instance=ExtResource("2_hkmoa")]
|
||||
visible = false
|
||||
|
||||
[node name="OverworldScene" parent="." instance=ExtResource("2_o1wvd")]
|
||||
visible = false
|
Reference in New Issue
Block a user