32 lines
817 B
GDScript
32 lines
817 B
GDScript
extends Node
|
|
|
|
@onready var player: CharacterBody3D = %Player
|
|
@onready var outside_world: SubViewport = %OutsideWorld
|
|
@onready var inside_world: SubViewport = %InsideWorld
|
|
@onready var sub_viewport_container: SubViewportContainer = $SubViewportContainer
|
|
|
|
var current_world: Node
|
|
|
|
func _ready() -> void:
|
|
current_world = outside_world
|
|
|
|
|
|
func _process(delta: float) -> void:
|
|
if Input.is_action_just_pressed("debug_teleport"):
|
|
_on_teleport_button_pressed()
|
|
|
|
|
|
func _on_teleport_button_pressed() -> void:
|
|
if current_world == outside_world:
|
|
outside_world.reparent(self)
|
|
inside_world.reparent(sub_viewport_container)
|
|
current_world = inside_world
|
|
else:
|
|
inside_world.reparent(self)
|
|
outside_world.reparent(sub_viewport_container)
|
|
current_world = outside_world
|
|
|
|
player.reparent(current_world.get_child(0))
|
|
|
|
|