28 lines
653 B
GDScript
28 lines
653 B
GDScript
@tool
|
|
extends Node3D
|
|
|
|
enum EnumWorld {CUBIC_WORLD, SMOOTH_WORLD}
|
|
|
|
@export var wanted_world: EnumWorld
|
|
|
|
var enabled_world: EnumWorld = EnumWorld.CUBIC_WORLD
|
|
|
|
signal change_world
|
|
|
|
func _process(_delta: float) -> void:
|
|
if enabled_world != wanted_world:
|
|
print("changing world")
|
|
emit_signal("change_world")
|
|
|
|
func _on_change_world():
|
|
match wanted_world:
|
|
EnumWorld.CUBIC_WORLD:
|
|
if $SmoothWorld:
|
|
$SmoothWorld.queue_free()
|
|
add_child(load("res://cubic_world.tscn").instantiate())
|
|
EnumWorld.SMOOTH_WORLD:
|
|
if $CubicWorld:
|
|
$CubicWorld.queue_free()
|
|
add_child(load("res://smooth_world.tscn").instantiate())
|
|
enabled_world = wanted_world
|