32 lines
1.1 KiB
GDScript
32 lines
1.1 KiB
GDScript
extends Label3D
|
|
|
|
@onready var timer: Timer = $"../Timer"
|
|
@onready var construct: Node3D = get_tree().get_first_node_in_group("Constructs")
|
|
@onready var timer_door: Node3D = get_tree().get_first_node_in_group("timer_door")
|
|
@onready var exit_label: Label3D = get_tree().get_first_node_in_group("exit_label")
|
|
|
|
var door_state: bool = false
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
##Displays HH:MM:SS left from the timer on the label
|
|
$".".text = "This door will open in\n" + "%02d:%02d:%02d" % [floor(timer.time_left / 3600), int(floor(timer.time_left / 60)) % 60, int(timer.time_left) % 60]
|
|
if construct.CONSTRUCT_TYPE.name == "Time" and Input.is_action_just_pressed("UseConstruct"):
|
|
#print("ZA WORLDO!!!!!!!")
|
|
if timer.wait_time <= 3600:
|
|
timer.wait_time = 1
|
|
timer.start()
|
|
else:
|
|
timer.wait_time -= 3600
|
|
timer.start()
|
|
#print(timer.wait_time)
|
|
|
|
|
|
func _on_timer_timeout() -> void:
|
|
##ADD LOGIC HERE TO MAKE THE TIMER DOOR OPEN
|
|
if !door_state:
|
|
print("THE DOOR IS NOW OPEN")
|
|
exit_label.hide()
|
|
timer_door.get_node("AnimationPlayer").play("door_open")
|
|
door_state = true
|
|
|