-
Notifications
You must be signed in to change notification settings - Fork 1
/
IntroManager.gd
327 lines (302 loc) · 11 KB
/
IntroManager.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
class_name IntroManager extends Node
@export var cameraParent : Node3D
@export var intbranch_bathroomdoor : InteractionBranch
@export var intbranch_backroomdoor: InteractionBranch
@export var intbranch_pillbottle : InteractionBranch
@export var parent_pills : Node3D
@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
@export var animator_pillchoice : AnimationPlayer
@export var speaker_pillchoice : AudioStreamPlayer2D
@export var intbranch_pillyes : InteractionBranch
@export var intbranch_pillno : InteractionBranch
@export var intbranch_crt : InteractionBranch
@export var speaker_pillselect : AudioStreamPlayer2D
@export var anim_revert : AnimationPlayer
@export var endlessmode : Endless
@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
var allowingPills = false
func _ready():
parent_pills.visible = false
allowingPills = false
SetControllerState()
await get_tree().create_timer(.5, false).timeout
if (roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
RevivalBathroomStart()
else:
MainBathroomStart()
if (roundManager.playerData.playerEnteringFromDeath or roundManager.playerData.enteringFromTrueDeath):
parent_pills.visible = false
allowingPills = false
if (!roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
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)
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
if (allowingPills):
intbranch_pillbottle.interactionAllowed = true
if (GlobalVariables.using_steam): intbranch_crt.interactionAllowed = true
if (cursor.controller_active): btn_bathroomdoor.grab_focus()
controller.previousFocus = btn_bathroomdoor
if (allowingPills):
btn_pills.visible = true
if (GlobalVariables.using_steam): btn_screen.visible = true
btn_bathroomdoor.visible = true
anim_pillflicker.play("flicker pill")
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")
dia.ShowText_Forever(tr("YOURE LUCKY"))
var n = roundManager.playerData.playername
var firstpart = tr("GET UP") % [n]
#tr("GAME_STATUS_%d" % status_index)
var secondpart = "\n"+tr("THE NIGHT")
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)
if (allowingPills):
intbranch_pillbottle.interactionAllowed = true
if (GlobalVariables.using_steam):
intbranch_crt.interactionAllowed = true
btn_screen.visible = true
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
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()
func Interaction_PillBottle():
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_screen.visible = false
btn_bathroomdoor.visible = false
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)
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
intbranch_pillyes.interactionAllowed = true
intbranch_pillno.interactionAllowed = true
@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
func SelectedPill(selected : bool):
if (selected):
pill_unlock.IncrementAmount()
anim_pillflicker.play("RESET")
cursor.SetCursor(false, false)
for c in col_pillchoice: c.disabled = true
animator_pp.play("brightness fade out")
anim_revert.play("revert")
animator_pillchoice.play("hide")
speaker_pillchoice.stop()
speaker_pillselect.play()
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
if(selected):
parent_pills.visible = false
endlessmode.SetupEndless()
RestRoomIdle()
if selected: crtManager.SetCRT(false)
animator_pp.play("brightness fade in")
await get_tree().create_timer(.6, false).timeout
cursor.SetCursor(true, true)
if (selected): ach.UnlockAchievement("ach3")
intbranch_bathroomdoor.interactionAllowed = true
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
pass
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
@export var statue : Statue
func Interaction_BackroomDoor():
statue.CheckStatus()
roundManager.playerData.stat_doorsKicked += 1
animator_camera.play("camera enter backroom")
intbranch_backroomdoor.interactionAllowed = false
btn_backroom.visible = false
cursor.SetCursor(false, false)
counting = false
func Interaction_BathroomDoor():
intbranch_bathroomdoor.interactionAllowed = false
cursor.SetCursor(false, false)
btn_pills.visible = false
btn_screen.visible = false
btn_bathroomdoor.visible = false
animator_camera.play("camera exit bathroom")
await get_tree().create_timer(5, false).timeout
cursor.SetCursor(true, true)
if (cursor.controller_active): btn_backroom.grab_focus()
controller.previousFocus = btn_backroom
btn_backroom.visible = true
intbranch_backroomdoor.interactionAllowed = true
intbranch_pillbottle.interactionAllowed = false
intbranch_crt.interactionAllowed = false
counting = true
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()
@export var pipeline : PipelineManager
func RestRoomIdle():
pipeline.AdjustSettings(pipeline.scene)
animator_camera.play("camera idle bathroom")
pass