frame-of-mind/src/base-environments/youth_room/room_handle.gd

56 lines
1.3 KiB
GDScript

extends Node3D
# Referencing the current State of the Scene.
enum Modes {
FREEZE,
WALKING,
COLLECTING,
LISTENING,
SORTING
}
signal freeze
signal unfreeze
var current_mode: int = Modes.FREEZE:
set(new_mode):
if not current_mode == new_mode:
current_mode = _update_scene(new_mode)
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("ui_cancel"):
State.pass_focus_to($picker)
func start():
$light_animation.play("light_up")
$AudioPlayer.play("intro")
State.pass_focus_to($PlayerController)
current_mode = Modes.WALKING
func _update_scene(new_mode) -> int:
if current_mode == Modes.FREEZE:
emit_signal("freeze")
elif new_mode == Modes.FREEZE:
emit_signal("freeze")
return new_mode
func _unhandled_input(event):
if event is InputEventMouseButton:
if event.pressed:
print("passed")
#State.pass_focus_to($PlayerController)
func _on_childhood_collected():
$light_animation.play("lights_out")
func _on_childhood_done():
State.pass_focus_to($picker)
$light_animation.play("light_up")
$PlayerController.on_childhood_done()