2024-01-20 12:17:43 +00:00
|
|
|
class_name Heaven extends Node
|
|
|
|
|
2024-04-05 10:52:30 +01:00
|
|
|
@export var controller : ControllerManager
|
2024-01-20 12:17:43 +00:00
|
|
|
@export var cursor : CursorManager
|
|
|
|
@export var viewblocker : Control
|
|
|
|
@export var speaker_music : AudioStreamPlayer2D
|
|
|
|
@export var animator : AnimationPlayer
|
|
|
|
@export var intbranch_heavendoor : InteractionBranch
|
|
|
|
@export var interactionManager : InteractionManager
|
|
|
|
@export var buttonArray : Array[ButtonClass]
|
|
|
|
@export var speaker_button : AudioStreamPlayer2D
|
2024-04-05 10:52:30 +01:00
|
|
|
@export var ui : Array[Control]
|
|
|
|
@export var ach : Achievement
|
2024-01-20 12:17:43 +00:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
Signals()
|
|
|
|
BeginLoop()
|
2024-04-05 10:52:30 +01:00
|
|
|
CheckControllerState()
|
|
|
|
await get_tree().create_timer(1, false).timeout
|
|
|
|
ach.UnlockAchievement("ach2")
|
2024-01-20 12:17:43 +00:00
|
|
|
|
|
|
|
func Signals():
|
|
|
|
buttonArray[0].is_pressed.connect(Button_Retry)
|
|
|
|
buttonArray[1].is_pressed.connect(Button_Exit)
|
|
|
|
pass
|
|
|
|
|
2024-04-05 10:52:30 +01:00
|
|
|
func CheckControllerState():
|
|
|
|
if (GlobalVariables.controllerEnabled):
|
|
|
|
controller.SetMainControllerState(true)
|
|
|
|
|
2024-01-20 12:17:43 +00:00
|
|
|
func Button_Retry():
|
|
|
|
Button_Main("retry")
|
|
|
|
|
|
|
|
func Button_Exit():
|
|
|
|
Button_Main("exit")
|
|
|
|
|
|
|
|
func Button_Main(tag : String):
|
|
|
|
speaker_music.stop()
|
|
|
|
speaker_button.play()
|
|
|
|
cursor.SetCursor(false, false)
|
|
|
|
animator.play("fade out")
|
2024-04-05 10:52:30 +01:00
|
|
|
for u in ui: u.visible = false
|
2024-01-20 12:17:43 +00:00
|
|
|
for cl in buttonArray:
|
|
|
|
cl.isActive = false
|
|
|
|
await get_tree().create_timer(3.12, false).timeout
|
|
|
|
match tag:
|
|
|
|
"retry":
|
2024-04-10 19:19:04 +01:00
|
|
|
print("changing scene to: death")
|
2024-01-20 12:17:43 +00:00
|
|
|
get_tree().change_scene_to_file("res://scenes/death.tscn")
|
|
|
|
"exit":
|
|
|
|
get_tree().quit()
|
|
|
|
|
2024-04-05 10:52:30 +01:00
|
|
|
@export var bracket_door : Node3D
|
|
|
|
@export var btn_door : Control
|
|
|
|
@export var btn_retry : Control
|
|
|
|
@export var btn_exit : Control
|
2024-01-20 12:17:43 +00:00
|
|
|
func BeginLoop():
|
|
|
|
await get_tree().create_timer(1, false).timeout
|
|
|
|
speaker_music.play()
|
|
|
|
viewblocker.visible = false
|
|
|
|
animator.play("camera pan down")
|
|
|
|
animator.queue("camera idle")
|
|
|
|
await get_tree().create_timer(11.1, false).timeout
|
2024-04-05 10:52:30 +01:00
|
|
|
if (cursor.controller_active): btn_door.grab_focus()
|
|
|
|
controller.previousFocus = btn_door
|
|
|
|
btn_door.visible = true
|
2024-01-20 12:17:43 +00:00
|
|
|
cursor.SetCursor(true, true)
|
|
|
|
intbranch_heavendoor.interactionAllowed = true
|
|
|
|
|
|
|
|
func Fly():
|
2024-04-05 10:52:30 +01:00
|
|
|
btn_door.visible = false
|
|
|
|
bracket_door.visible = false
|
2024-01-20 12:17:43 +00:00
|
|
|
intbranch_heavendoor.interactionAllowed = false
|
|
|
|
cursor.SetCursor(false, false)
|
|
|
|
animator.play("move")
|
|
|
|
await get_tree().create_timer(15.6, false).timeout
|
|
|
|
cursor.SetCursor(true, true)
|
2024-04-05 10:52:30 +01:00
|
|
|
if (cursor.controller_active): btn_retry.grab_focus()
|
|
|
|
controller.previousFocus = btn_retry
|
2024-01-20 12:17:43 +00:00
|
|
|
interactionManager.checking = false
|
|
|
|
for cl in buttonArray:
|
|
|
|
cl.isActive = true
|
|
|
|
pass
|