-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDeathManager.gd
174 lines (167 loc) · 6.86 KB
/
DeathManager.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
class_name DeathManager extends Node
@export var cam : CameraManager
@export var viewblocker : ColorRect
@export var speakersToDisable : Array[SpeakerController]
@export var animator_playerDefib : AnimationPlayer
@export var defibParent : Node3D
@export var speaker_playerDefib : AudioStreamPlayer2D
@export var cameraShaker : CameraShaker
@export var healthCounter : HealthCounter
@export var animator_shotgun : AnimationPlayer
@export var ejectManager_player : ShellEjectManager
@export var ejectManager_dealer : ShellEjectManager
@export var shotgunShooting : ShotgunShooting
@export var animator_dealer : AnimationPlayer
@export var speaker_crash : AudioStreamPlayer3D
@export var dealerAI : DealerIntelligence
@export var animator_dealerHands : AnimationPlayer
@export var shellLoader : ShellLoader
@export var scene_death : PackedScene
@export var savefile : SaveFileManager
@export var filter : FilterController
@export var animator_pp : AnimationPlayer
@export var speaker_heartbeat : AudioStreamPlayer2D
@export var rm : RoundManager
func _ready():
defibParent.visible = false
var shitIsFuckedUp = false
func Kill(who : String, trueDeath : bool, returningShotgun : bool):
var dealerKilledSelf = false
shitIsFuckedUp = false
match(who):
"player":
if (trueDeath):
pass
else:
await get_tree().create_timer(.08, false).timeout
viewblocker.visible = true
if (returningShotgun):
var addingDelay = false
animator_shotgun.play("RESET")
ejectManager_player.DeathEjection()
await get_tree().create_timer(2)
if (shotgunShooting.roundManager.health_opponent == 1 or shotgunShooting.roundManager.health_player == 1): addingDelay = true
#if (shellLoader.roundManager.shellSpawner.sequenceArray.size() != 0): shotgunShooting.delaying = true
if (shotgunShooting.roundManager.health_player == 1): shitIsFuckedUp = true
if (shotgunShooting.roundManager.health_player != 0): shotgunShooting.FinalizeShooting(shotgunShooting.playerCanGoAgain, false, true, addingDelay)
DisableSpeakers()
if (shotgunShooting.roundManager.health_player == 0):
shotgunShooting.roundManager.OutOfHealth("player")
return
await get_tree().create_timer(.4, false).timeout
speaker_playerDefib.play()
await get_tree().create_timer(.85, false).timeout
speaker_heartbeat.play()
animator_pp.play("revival brightness")
defibParent.visible = true
animator_playerDefib.play("RESET")
viewblocker.visible = false
filter.BeginPan(filter.lowPassMaxValue, filter.lowPassDefaultValue)
FadeInSpeakers()
cameraShaker.Shake()
await get_tree().create_timer(.6, false).timeout
animator_playerDefib.play("remove defib device")
await get_tree().create_timer(.4, false).timeout
await(healthCounter.UpdateDisplayRoutine(false, !shotgunShooting.playerCanGoAgain, false))
defibParent.visible = false
pass
"dealer":
if (trueDeath):
pass
else:
if (returningShotgun):
dealerKilledSelf = true
shotgunShooting.MainSlowDownRoutine("dealer", true)
animator_shotgun.play("enemy return shotgun self")
dealerAI.dealerHoldingShotgun = false
ejectManager_dealer.DeathEjection()
animator_dealer.play("dealer fly away")
animator_dealerHands.play("hide hands")
dealerAI.SwapDealerMesh()
shellLoader.shotgunHand_L.visible = false
shellLoader.shotgunHand_R.visible = false
shotgunShooting.roundManager.dealerAtTable = false
await get_tree().create_timer(.4, false).timeout
speaker_crash.play()
if (!dealerKilledSelf):
#player shot dealer. eject shell and end turn here.
shotgunShooting.ShootingDealerEjection(shotgunShooting.shellSpawner.sequenceArray[0], "dealer", false)
pass
await get_tree().create_timer(1.8, false).timeout
if(shotgunShooting.roundManager.health_opponent == 0):
shotgunShooting.roundManager.OutOfHealth("dealer")
healthCounter.UpdateDisplayRoutine(false, false, true)
return
if (shotgunShooting.roundManager.health_player == 0):
shotgunShooting.roundManager.OutOfHealth("player")
return
if (dealerKilledSelf): healthCounter.checkingPlayer = true
else: healthCounter.checkingPlayer = false
await(healthCounter.UpdateDisplayRoutine(false, true, false))
if (!shotgunShooting.roundManager.dealerCuffed):
animator_dealerHands.play("dealer hands on table")
shotgunShooting.roundManager.waitingForDealerReturn = true
else:
animator_dealerHands.play("dealer hands on table cuffed")
shotgunShooting.roundManager.waitingForReturn = true
animator_dealer.play("dealer return to table")
await get_tree().create_timer(2, false).timeout
if (dealerKilledSelf): dealerAI.EndDealerTurn(dealerAI.dealerCanGoAgain)
func MedicineDeath():
viewblocker.visible = true
cam.cam.rotation_degrees = Vector3(cam.cam.rotation_degrees.x, cam.cam.rotation_degrees.y, 0)
DisableSpeakers()
if (shotgunShooting.roundManager.health_player == 0):
shotgunShooting.roundManager.OutOfHealth("player")
return
await get_tree().create_timer(.4, false).timeout
speaker_playerDefib.play()
await get_tree().create_timer(.85, false).timeout
speaker_heartbeat.play()
animator_pp.play("revival brightness")
defibParent.visible = true
animator_playerDefib.play("RESET")
viewblocker.visible = false
filter.BeginPan(filter.lowPassMaxValue, filter.lowPassDefaultValue)
FadeInSpeakers()
cameraShaker.Shake()
await get_tree().create_timer(.6, false).timeout
animator_playerDefib.play("remove defib device")
await get_tree().create_timer(.4, false).timeout
#await(healthCounter.UpdateDisplayRoutine(false, !shotgunShooting.playerCanGoAgain, false))
defibParent.visible = false
@export var ach : Achievement
func MainDeathRoutine():
var loadingHeaven = false
if (shotgunShooting.roundManager.endless):
if (rm.endscore != null):
if (rm.endscore > 1000000): ach.UnlockAchievement("ach10")
await get_tree().create_timer(.5, false).timeout
print("changing scene to: death")
get_tree().change_scene_to_file("res://scenes/death.tscn")
return
if (shotgunShooting.roundManager.wireIsCut_player):
shotgunShooting.roundManager.playerData.enteringFromTrueDeath = true
loadingHeaven = true
shotgunShooting.roundManager.playerData.playerEnteringFromDeath = true
await(savefile.SaveGame())
await get_tree().create_timer(.5, false).timeout
if (!loadingHeaven):
print("changing scene to: death")
get_tree().change_scene_to_file("res://scenes/death.tscn")
else:
print("changing scene to: heaven")
get_tree().change_scene_to_file("res://scenes/heaven.tscn")
pass
func DisableSpeakers():
for i in range(speakersToDisable.size()):
speakersToDisable[i].SnapVolume(false)
func FadeInSpeakers():
for i in range(speakersToDisable.size()):
speakersToDisable[i].fadeDuration = 3
speakersToDisable[i].FadeIn()
#if (i != 1):
# speakersToDisable[i].fadeDuration = 3
# speakersToDisable[i].FadeIn()
#else:
# speakersToDisable[i].SnapVolume(true)