2024-01-20 12:17:43 +00:00
|
|
|
class_name IntroManager extends Node
|
|
|
|
|
|
|
|
@export var cameraParent : Node3D
|
|
|
|
@export var intbranch_bathroomdoor : InteractionBranch
|
|
|
|
@export var intbranch_backroomdoor: InteractionBranch
|
2024-01-28 11:58:35 +00:00
|
|
|
@export var intbranch_pillbottle : InteractionBranch
|
|
|
|
@export var parent_pills : Node3D
|
2024-01-20 12:17:43 +00:00
|
|
|
@export var cursor : CursorManager
|
|
|
|
@export var roundManager : RoundManager
|
|
|
|
@export var speaker_amb_restroom : AudioStreamPlayer2D
|
|
|
|
@export var viewblocker : Control
|
|
|
|
@export var animator_camera : AnimationPlayer
|
|
|
|
@export var animator_smokerdude : AnimationPlayer
|
|
|
|
@export var musicmanager : MusicManager
|
|
|
|
@export var filter : FilterController
|
|
|
|
@export var bpmlight : BpmLight
|
|
|
|
@export var smokerdude_revival : Node3D
|
|
|
|
@export var speaker_defib : AudioStreamPlayer2D
|
|
|
|
@export var pos_floor : Vector3
|
|
|
|
@export var rot_floor : Vector3
|
|
|
|
@export var animator_pp : AnimationPlayer
|
|
|
|
@export var cameraShaker : CameraShaker
|
|
|
|
@export var dia : Dialogue
|
|
|
|
@export var blockout : Blockout
|
|
|
|
@export var animator_hint : AnimationPlayer
|
2024-01-28 11:58:35 +00:00
|
|
|
@export var animator_pillchoice : AnimationPlayer
|
|
|
|
@export var speaker_pillchoice : AudioStreamPlayer2D
|
|
|
|
@export var intbranch_pillyes : InteractionBranch
|
|
|
|
@export var intbranch_pillno : InteractionBranch
|
2024-04-05 10:52:30 +01:00
|
|
|
@export var intbranch_crt : InteractionBranch
|
2024-01-28 11:58:35 +00:00
|
|
|
@export var speaker_pillselect : AudioStreamPlayer2D
|
|
|
|
@export var anim_revert : AnimationPlayer
|
|
|
|
@export var endlessmode : Endless
|
2024-04-05 10:52:30 +01:00
|
|
|
@export var btn_bathroomdoor : Control
|
|
|
|
@export var btn_pills : Control
|
|
|
|
@export var btn_pillsYes : Control
|
|
|
|
@export var btn_pillsNo : Control
|
|
|
|
@export var btn_backroom : Control
|
|
|
|
@export var btn_screen : Control #append this with controller UI element
|
|
|
|
@export var controller : ControllerManager
|
|
|
|
@export var unlocker : Unlocker
|
|
|
|
@export var crtManager : CRT
|
|
|
|
@export var col_pillchoice : Array[CollisionShape3D]
|
|
|
|
@export var anim_pillflicker : AnimationPlayer
|
2024-01-20 12:17:43 +00:00
|
|
|
|
2024-01-28 11:58:35 +00:00
|
|
|
var allowingPills = false
|
2024-01-20 12:17:43 +00:00
|
|
|
func _ready():
|
2024-04-05 10:52:30 +01:00
|
|
|
parent_pills.visible = false
|
|
|
|
allowingPills = false
|
|
|
|
SetControllerState()
|
2024-01-20 12:17:43 +00:00
|
|
|
await get_tree().create_timer(.5, false).timeout
|
|
|
|
if (roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
|
|
|
|
RevivalBathroomStart()
|
|
|
|
else:
|
|
|
|
MainBathroomStart()
|
2024-01-28 11:58:35 +00:00
|
|
|
if (roundManager.playerData.playerEnteringFromDeath or roundManager.playerData.enteringFromTrueDeath):
|
|
|
|
parent_pills.visible = false
|
|
|
|
allowingPills = false
|
|
|
|
if (!roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
|
2024-04-05 10:52:30 +01:00
|
|
|
if (FileAccess.file_exists(unlocker.savepath)):
|
|
|
|
parent_pills.visible = true
|
|
|
|
crtManager.SetCRT(true)
|
|
|
|
allowingPills = true
|
|
|
|
|
|
|
|
var counting = false
|
|
|
|
var count_current = 0
|
|
|
|
var count_max = 60
|
|
|
|
var fs1 = false
|
|
|
|
func _process(delta):
|
|
|
|
if (counting): CountTimer()
|
|
|
|
|
|
|
|
func CountTimer():
|
|
|
|
if (counting): count_current += get_process_delta_time()
|
|
|
|
if (count_current > count_max && !fs1):
|
|
|
|
ach.UnlockAchievement("ach14")
|
|
|
|
fs1 = true
|
|
|
|
|
|
|
|
func SetControllerState():
|
|
|
|
if (GlobalVariables.controllerEnabled):
|
|
|
|
controller.SetMainControllerState(true)
|
2024-01-20 12:17:43 +00:00
|
|
|
|
|
|
|
func MainBathroomStart():
|
|
|
|
RestRoomIdle()
|
|
|
|
await get_tree().create_timer(.5, false).timeout
|
|
|
|
viewblocker.visible = false
|
|
|
|
MainTrackLoad()
|
|
|
|
await get_tree().create_timer(3, false).timeout
|
|
|
|
Hint()
|
|
|
|
cursor.SetCursor(true, true)
|
|
|
|
intbranch_bathroomdoor.interactionAllowed = true
|
2024-04-05 10:52:30 +01:00
|
|
|
if (allowingPills):
|
|
|
|
intbranch_pillbottle.interactionAllowed = true
|
2024-04-13 15:32:57 +01:00
|
|
|
if (GlobalVariables.using_steam): intbranch_crt.interactionAllowed = true
|
2024-04-05 10:52:30 +01:00
|
|
|
if (cursor.controller_active): btn_bathroomdoor.grab_focus()
|
|
|
|
controller.previousFocus = btn_bathroomdoor
|
2024-04-13 15:32:57 +01:00
|
|
|
if (allowingPills):
|
|
|
|
btn_pills.visible = true
|
|
|
|
if (GlobalVariables.using_steam): btn_screen.visible = true
|
2024-04-05 10:52:30 +01:00
|
|
|
btn_bathroomdoor.visible = true
|
|
|
|
anim_pillflicker.play("flicker pill")
|
2024-01-20 12:17:43 +00:00
|
|
|
|
|
|
|
func Hint():
|
|
|
|
await get_tree().create_timer(1, false).timeout
|
|
|
|
if (!roundManager.playerData.seenHint):
|
|
|
|
animator_hint.play("show")
|
|
|
|
roundManager.playerData.seenHint = true
|
|
|
|
|
|
|
|
func RevivalBathroomStart():
|
|
|
|
cameraParent.transform.origin = pos_floor
|
|
|
|
cameraParent.rotation_degrees = rot_floor
|
|
|
|
#animator_smokerdude.stop(true)
|
|
|
|
smokerdude_revival.visible = true
|
|
|
|
await get_tree().create_timer(1, false).timeout
|
|
|
|
speaker_defib.play()
|
|
|
|
await get_tree().create_timer(.85, false).timeout
|
|
|
|
dia.speaker_click.stream = dia.soundArray_clicks[0]
|
|
|
|
animator_smokerdude.play("revive player")
|
|
|
|
cameraShaker.Shake()
|
|
|
|
animator_pp.play("revival brightness")
|
|
|
|
viewblocker.visible = false
|
|
|
|
MainTrackLoad()
|
|
|
|
await get_tree().create_timer(.5, false).timeout
|
|
|
|
animator_smokerdude.play("revive player")
|
2024-04-05 10:52:30 +01:00
|
|
|
dia.ShowText_Forever(tr("YOURE LUCKY"))
|
2024-01-20 12:17:43 +00:00
|
|
|
var n = roundManager.playerData.playername
|
2024-04-05 10:52:30 +01:00
|
|
|
var firstpart = tr("GET UP") % [n]
|
|
|
|
#tr("GAME_STATUS_%d" % status_index)
|
|
|
|
var secondpart = "\n"+tr("THE NIGHT")
|
2024-01-20 12:17:43 +00:00
|
|
|
var full = firstpart + secondpart
|
|
|
|
await get_tree().create_timer(4, false).timeout
|
|
|
|
dia.ShowText_Forever(full)
|
|
|
|
await get_tree().create_timer(4, false).timeout
|
|
|
|
dia.HideText()
|
|
|
|
animator_pp.play("brightness fade out")
|
|
|
|
await get_tree().create_timer(2.05, false).timeout
|
|
|
|
smokerdude_revival.visible = false
|
|
|
|
RestRoomIdle()
|
|
|
|
animator_pp.play("brightness fade in")
|
|
|
|
dia.speaker_click.stream = dia.soundArray_clicks[3]
|
|
|
|
await get_tree().create_timer(3, false).timeout
|
|
|
|
cursor.SetCursor(true, true)
|
2024-04-05 10:52:30 +01:00
|
|
|
if (allowingPills):
|
|
|
|
intbranch_pillbottle.interactionAllowed = true
|
2024-04-13 15:32:57 +01:00
|
|
|
if (GlobalVariables.using_steam):
|
|
|
|
intbranch_crt.interactionAllowed = true
|
|
|
|
btn_screen.visible = true
|
2024-04-05 10:52:30 +01:00
|
|
|
btn_pills.visible = true
|
|
|
|
anim_pillflicker.play("flicker pill")
|
|
|
|
if (cursor.controller_active): btn_bathroomdoor.grab_focus()
|
|
|
|
controller.previousFocus = btn_bathroomdoor
|
|
|
|
btn_bathroomdoor.visible = true
|
2024-01-20 12:17:43 +00:00
|
|
|
intbranch_bathroomdoor.interactionAllowed = true
|
|
|
|
pass
|
|
|
|
|
|
|
|
func MainTrackLoad():
|
|
|
|
var increment = musicmanager.trackArray[roundManager.playerData.currentBatchIndex].bpmIncrement
|
|
|
|
bpmlight.delay = increment
|
|
|
|
musicmanager.LoadTrack()
|
|
|
|
bpmlight.BeginMainLoop()
|
|
|
|
speaker_amb_restroom.play()
|
|
|
|
|
2024-01-28 11:58:35 +00:00
|
|
|
func Interaction_PillBottle():
|
2024-04-05 10:52:30 +01:00
|
|
|
anim_pillflicker.play("RESET")
|
2024-01-28 11:58:35 +00:00
|
|
|
cursor.SetCursor(false, false)
|
|
|
|
intbranch_bathroomdoor.interactionAllowed = false
|
|
|
|
intbranch_pillbottle.interactionAllowed = false
|
2024-04-05 10:52:30 +01:00
|
|
|
intbranch_crt.interactionAllowed = false
|
|
|
|
btn_pills.visible = false
|
|
|
|
btn_screen.visible = false
|
|
|
|
btn_bathroomdoor.visible = false
|
2024-01-28 11:58:35 +00:00
|
|
|
animator_camera.play("camera check pills")
|
|
|
|
await get_tree().create_timer(.6, false).timeout
|
|
|
|
speaker_pillchoice.play()
|
|
|
|
await get_tree().create_timer(.3, false).timeout
|
|
|
|
animator_pillchoice.play("show")
|
|
|
|
await get_tree().create_timer(.7, false).timeout
|
|
|
|
cursor.SetCursor(true, true)
|
2024-04-05 10:52:30 +01:00
|
|
|
|
|
|
|
if (cursor.controller_active): btn_pillsNo.grab_focus()
|
|
|
|
controller.previousFocus = btn_pillsNo
|
|
|
|
for c in col_pillchoice: c.disabled = false
|
|
|
|
btn_pillsNo.visible = true
|
|
|
|
btn_pillsYes.visible = true
|
2024-01-28 11:58:35 +00:00
|
|
|
intbranch_pillyes.interactionAllowed = true
|
|
|
|
intbranch_pillno.interactionAllowed = true
|
|
|
|
|
2024-04-05 10:52:30 +01:00
|
|
|
@export var intbs_crtbuttons : Array[InteractionBranch]
|
|
|
|
func Interaction_CRT():
|
|
|
|
StartSound()
|
|
|
|
anim_pillflicker.play("RESET")
|
|
|
|
cursor.SetCursor(false, false)
|
|
|
|
intbranch_bathroomdoor.interactionAllowed = false
|
|
|
|
intbranch_pillbottle.interactionAllowed = false
|
|
|
|
intbranch_crt.interactionAllowed = false
|
|
|
|
btn_pills.visible = false
|
|
|
|
btn_bathroomdoor.visible = false
|
|
|
|
btn_screen.visible = false
|
|
|
|
animator_camera.play("camera check crt")
|
|
|
|
await get_tree().create_timer(2.6, false).timeout
|
|
|
|
crtManager.Bootup()
|
|
|
|
await get_tree().create_timer(0.54, false).timeout
|
|
|
|
|
|
|
|
func StartSound():
|
|
|
|
crtManager.speaker_playerwalk.play()
|
|
|
|
await get_tree().create_timer(2.04, false).timeout
|
|
|
|
crtManager.speaker_bootuploop.play()
|
|
|
|
|
|
|
|
func EnabledInteractionCRT():
|
|
|
|
cursor.SetCursor(true, true)
|
|
|
|
for b in intbs_crtbuttons: b.interactionAllowed = true
|
|
|
|
|
|
|
|
func DisableInteractionCrt():
|
|
|
|
cursor.SetCursor(false, false)
|
|
|
|
for b in intbs_crtbuttons: b.interactionAllowed = false
|
|
|
|
|
|
|
|
@export var ach : Achievement
|
|
|
|
@export var pill_unlock : Unlocker
|
2024-01-28 11:58:35 +00:00
|
|
|
func SelectedPill(selected : bool):
|
2024-04-05 10:52:30 +01:00
|
|
|
if (selected):
|
|
|
|
pill_unlock.IncrementAmount()
|
|
|
|
anim_pillflicker.play("RESET")
|
2024-01-28 11:58:35 +00:00
|
|
|
cursor.SetCursor(false, false)
|
2024-04-05 10:52:30 +01:00
|
|
|
for c in col_pillchoice: c.disabled = true
|
2024-01-28 11:58:35 +00:00
|
|
|
animator_pp.play("brightness fade out")
|
|
|
|
anim_revert.play("revert")
|
|
|
|
animator_pillchoice.play("hide")
|
|
|
|
speaker_pillchoice.stop()
|
|
|
|
speaker_pillselect.play()
|
2024-04-05 10:52:30 +01:00
|
|
|
btn_pillsYes.visible = false
|
|
|
|
btn_pillsNo.visible = false
|
2024-01-28 11:58:35 +00:00
|
|
|
intbranch_pillyes.interactionAllowed = false
|
|
|
|
intbranch_pillno.interactionAllowed = false
|
|
|
|
await get_tree().create_timer(2.05, false).timeout
|
|
|
|
if(selected):
|
|
|
|
parent_pills.visible = false
|
|
|
|
endlessmode.SetupEndless()
|
|
|
|
RestRoomIdle()
|
2024-04-05 10:52:30 +01:00
|
|
|
if selected: crtManager.SetCRT(false)
|
2024-01-28 11:58:35 +00:00
|
|
|
animator_pp.play("brightness fade in")
|
|
|
|
await get_tree().create_timer(.6, false).timeout
|
|
|
|
cursor.SetCursor(true, true)
|
2024-04-05 10:52:30 +01:00
|
|
|
if (selected): ach.UnlockAchievement("ach3")
|
2024-01-28 11:58:35 +00:00
|
|
|
intbranch_bathroomdoor.interactionAllowed = true
|
2024-04-05 10:52:30 +01:00
|
|
|
btn_bathroomdoor.visible = true
|
|
|
|
if(!selected):
|
|
|
|
intbranch_pillbottle.interactionAllowed = true
|
|
|
|
intbranch_crt.interactionAllowed = true
|
|
|
|
btn_pills.visible = true
|
|
|
|
btn_screen.visible = true
|
|
|
|
anim_pillflicker.play("flicker pill")
|
|
|
|
if (cursor.controller_active): btn_bathroomdoor.grab_focus()
|
|
|
|
controller.previousFocus = btn_bathroomdoor
|
2024-01-28 11:58:35 +00:00
|
|
|
pass
|
|
|
|
|
2024-04-05 10:52:30 +01:00
|
|
|
func RevertCRT():
|
|
|
|
animator_pp.play("brightness fade out")
|
|
|
|
#anim_revert.play("revert")
|
|
|
|
btn_pillsYes.visible = false
|
|
|
|
btn_pillsNo.visible = false
|
|
|
|
intbranch_pillyes.interactionAllowed = false
|
|
|
|
intbranch_pillno.interactionAllowed = false
|
|
|
|
await get_tree().create_timer(2.05, false).timeout
|
|
|
|
RestRoomIdle()
|
|
|
|
animator_pp.play("brightness fade in")
|
|
|
|
anim_pillflicker.play("flicker pill")
|
|
|
|
await get_tree().create_timer(.6, false).timeout
|
|
|
|
cursor.SetCursor(true, true)
|
|
|
|
intbranch_bathroomdoor.interactionAllowed = true
|
|
|
|
btn_bathroomdoor.visible = true
|
|
|
|
intbranch_pillbottle.interactionAllowed = true
|
|
|
|
intbranch_crt.interactionAllowed = true
|
|
|
|
btn_pills.visible = true
|
|
|
|
btn_screen.visible = true
|
|
|
|
if (cursor.controller_active): btn_bathroomdoor.grab_focus()
|
|
|
|
controller.previousFocus = btn_bathroomdoor
|
|
|
|
|
2024-04-10 19:19:04 +01:00
|
|
|
@export var statue : Statue
|
2024-01-20 12:17:43 +00:00
|
|
|
func Interaction_BackroomDoor():
|
2024-04-10 19:19:04 +01:00
|
|
|
statue.CheckStatus()
|
2024-01-20 12:17:43 +00:00
|
|
|
roundManager.playerData.stat_doorsKicked += 1
|
|
|
|
animator_camera.play("camera enter backroom")
|
|
|
|
intbranch_backroomdoor.interactionAllowed = false
|
2024-04-05 10:52:30 +01:00
|
|
|
btn_backroom.visible = false
|
2024-01-20 12:17:43 +00:00
|
|
|
cursor.SetCursor(false, false)
|
2024-04-05 10:52:30 +01:00
|
|
|
counting = false
|
2024-01-20 12:17:43 +00:00
|
|
|
|
|
|
|
func Interaction_BathroomDoor():
|
|
|
|
intbranch_bathroomdoor.interactionAllowed = false
|
|
|
|
cursor.SetCursor(false, false)
|
2024-04-05 10:52:30 +01:00
|
|
|
btn_pills.visible = false
|
|
|
|
btn_screen.visible = false
|
|
|
|
btn_bathroomdoor.visible = false
|
2024-01-20 12:17:43 +00:00
|
|
|
animator_camera.play("camera exit bathroom")
|
|
|
|
await get_tree().create_timer(5, false).timeout
|
|
|
|
cursor.SetCursor(true, true)
|
2024-04-05 10:52:30 +01:00
|
|
|
if (cursor.controller_active): btn_backroom.grab_focus()
|
|
|
|
controller.previousFocus = btn_backroom
|
|
|
|
btn_backroom.visible = true
|
2024-01-20 12:17:43 +00:00
|
|
|
intbranch_backroomdoor.interactionAllowed = true
|
2024-01-28 11:58:35 +00:00
|
|
|
intbranch_pillbottle.interactionAllowed = false
|
2024-04-05 10:52:30 +01:00
|
|
|
intbranch_crt.interactionAllowed = false
|
|
|
|
counting = true
|
2024-01-20 12:17:43 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
func BeginGame():
|
|
|
|
blockout.HideClub()
|
|
|
|
roundManager.BeginMainGame()
|
|
|
|
|
|
|
|
func PanFilter():
|
|
|
|
filter.BeginPan(filter.lowPassMaxValue, filter.lowPassDefaultValue)
|
|
|
|
pass
|
|
|
|
|
|
|
|
func KickDoorBackroom():
|
|
|
|
pass
|
|
|
|
|
|
|
|
func KickDoorLobby():
|
|
|
|
roundManager.playerData.stat_doorsKicked += 1
|
|
|
|
await get_tree().create_timer(.25, false).timeout
|
|
|
|
filter.BeginPan(filter.lowPassDefaultValue, filter.lowPassMaxValue)
|
|
|
|
speaker_amb_restroom.stop()
|
|
|
|
|
2024-04-10 19:19:04 +01:00
|
|
|
@export var pipeline : PipelineManager
|
2024-01-20 12:17:43 +00:00
|
|
|
func RestRoomIdle():
|
2024-04-10 19:19:04 +01:00
|
|
|
pipeline.AdjustSettings(pipeline.scene)
|
2024-01-20 12:17:43 +00:00
|
|
|
animator_camera.play("camera idle bathroom")
|
|
|
|
pass
|