mirror of
https://github.com/thecatontheceiling/buckshotroulette-decomp.git
synced 2024-12-04 11:27:27 +00:00
Add files via upload
This commit is contained in:
commit
33efc85007
23
BlinkerBranch.gd
Normal file
23
BlinkerBranch.gd
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
class_name BlinkerBranch extends Node
|
||||||
|
|
||||||
|
@export var mat_1 : StandardMaterial3D
|
||||||
|
@export var mat_2 : StandardMaterial3D
|
||||||
|
@export var delay_range1 : float
|
||||||
|
@export var delay_range2 : float
|
||||||
|
var parent : MeshInstance3D
|
||||||
|
var looping = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
parent = get_parent()
|
||||||
|
looping = true
|
||||||
|
Loop()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func Loop():
|
||||||
|
while (looping):
|
||||||
|
var delay = randf_range(delay_range1, delay_range2)
|
||||||
|
parent.set_surface_override_material(0, mat_1)
|
||||||
|
await get_tree().create_timer(delay, false).timeout
|
||||||
|
parent.set_surface_override_material(0, mat_2)
|
||||||
|
await get_tree().create_timer(delay, false).timeout
|
||||||
|
pass
|
7
BlockoutManager.gd
Normal file
7
BlockoutManager.gd
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
class_name Blockout extends Node
|
||||||
|
|
||||||
|
@export var objArray_club : Array[Node3D]
|
||||||
|
|
||||||
|
func HideClub():
|
||||||
|
for i in range(objArray_club.size()):
|
||||||
|
objArray_club[i].visible = false
|
26
BpmLight.gd
Normal file
26
BpmLight.gd
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
class_name BpmLight extends Node
|
||||||
|
|
||||||
|
@export var animator : AnimationPlayer
|
||||||
|
var delay
|
||||||
|
var l
|
||||||
|
var looping = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
l = get_parent()
|
||||||
|
|
||||||
|
func BeginMainLoop():
|
||||||
|
looping = true
|
||||||
|
BeginLoop()
|
||||||
|
|
||||||
|
func Hit():
|
||||||
|
animator.play("hit")
|
||||||
|
pass
|
||||||
|
|
||||||
|
func BeginLoop():
|
||||||
|
while (looping):
|
||||||
|
Hit()
|
||||||
|
await get_tree().create_timer(delay, false).timeout
|
||||||
|
Hit()
|
||||||
|
await get_tree().create_timer(delay, false).timeout
|
||||||
|
pass
|
||||||
|
pass
|
63
BriefcaseMachine.gd
Normal file
63
BriefcaseMachine.gd
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
class_name BriefcaseMachine extends Node
|
||||||
|
|
||||||
|
@export var ending : EndingManager
|
||||||
|
@export var cam : CameraManager
|
||||||
|
@export var cursor : CursorManager
|
||||||
|
@export var parent_eyes : Node3D
|
||||||
|
@export var parent_machine : Node3D
|
||||||
|
@export var speaker_machine : AudioStreamPlayer2D
|
||||||
|
@export var anim_machine : AnimationPlayer
|
||||||
|
@export var speaker_latchL : AudioStreamPlayer2D
|
||||||
|
@export var speaker_latchR : AudioStreamPlayer2D
|
||||||
|
@export var speaker_lid : AudioStreamPlayer2D
|
||||||
|
@export var anim_latchL : AnimationPlayer
|
||||||
|
@export var anim_latchR : AnimationPlayer
|
||||||
|
@export var anim_lid : AnimationPlayer
|
||||||
|
@export var intbranch_L : InteractionBranch
|
||||||
|
@export var intbranch_R : InteractionBranch
|
||||||
|
@export var intbranch_lid : InteractionBranch
|
||||||
|
|
||||||
|
var latchRaisedL = false
|
||||||
|
var latchRaisedR = false
|
||||||
|
|
||||||
|
func MainRoutine():
|
||||||
|
speaker_machine.play()
|
||||||
|
await get_tree().create_timer(.42, false).timeout
|
||||||
|
parent_eyes.visible = true
|
||||||
|
await get_tree().create_timer(1.28, false).timeout
|
||||||
|
parent_eyes.visible = false
|
||||||
|
anim_machine.play("move to table")
|
||||||
|
parent_machine.visible = true
|
||||||
|
await get_tree().create_timer(5.14, false).timeout
|
||||||
|
cam.BeginLerp("cash briefcase")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
intbranch_L.interactionAllowed = true
|
||||||
|
intbranch_R.interactionAllowed = true
|
||||||
|
|
||||||
|
func CheckLatches():
|
||||||
|
if (latchRaisedL == true && latchRaisedR == true):
|
||||||
|
await get_tree().create_timer(.3, false).timeout
|
||||||
|
intbranch_lid.interactionAllowed = true
|
||||||
|
|
||||||
|
func OpenLatch(alias : String):
|
||||||
|
match (alias):
|
||||||
|
"L":
|
||||||
|
intbranch_L.interactionAllowed = false
|
||||||
|
speaker_latchL.play()
|
||||||
|
anim_latchL.play("raise")
|
||||||
|
latchRaisedL = true
|
||||||
|
CheckLatches()
|
||||||
|
"R":
|
||||||
|
intbranch_R.interactionAllowed = false
|
||||||
|
speaker_latchR.play()
|
||||||
|
anim_latchR.play("raise")
|
||||||
|
latchRaisedR = true
|
||||||
|
CheckLatches()
|
||||||
|
|
||||||
|
func OpenLid():
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
intbranch_lid.interactionAllowed = false
|
||||||
|
anim_lid.play("open")
|
||||||
|
speaker_lid.play()
|
||||||
|
ending.BeginEnding()
|
36
ButtonClass.gd
Normal file
36
ButtonClass.gd
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
class_name ButtonClass extends Node
|
||||||
|
|
||||||
|
@export var cursor : CursorManager
|
||||||
|
@export var alias : String
|
||||||
|
@export var isActive : bool
|
||||||
|
@export var isDynamic : bool
|
||||||
|
@export var ui : CanvasItem
|
||||||
|
@export var speaker_press : AudioStreamPlayer2D
|
||||||
|
@export var speaker_hover : AudioStreamPlayer2D
|
||||||
|
@export var playing : bool
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
get_parent().connect("mouse_entered", OnHover)
|
||||||
|
get_parent().connect("mouse_exited", OnExit)
|
||||||
|
get_parent().connect("pressed", OnPress)
|
||||||
|
pass
|
||||||
|
|
||||||
|
func OnHover():
|
||||||
|
if (isActive):
|
||||||
|
if (isDynamic):
|
||||||
|
speaker_hover.pitch_scale = randf_range(.95, 1.0)
|
||||||
|
speaker_hover.play()
|
||||||
|
ui.modulate.a = .78
|
||||||
|
cursor.SetCursorImage("hover")
|
||||||
|
|
||||||
|
func OnExit():
|
||||||
|
if (isActive):
|
||||||
|
if (isDynamic):
|
||||||
|
ui.modulate.a = 1
|
||||||
|
cursor.SetCursorImage("point")
|
||||||
|
|
||||||
|
signal is_pressed
|
||||||
|
func OnPress():
|
||||||
|
if (isActive):
|
||||||
|
if (isDynamic && playing): speaker_press.play()
|
||||||
|
emit_signal("is_pressed")
|
96
CameraManager.gd
Normal file
96
CameraManager.gd
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
class_name CameraManager extends Node
|
||||||
|
|
||||||
|
@export var cam : Camera3D
|
||||||
|
@export var obj : Node3D
|
||||||
|
|
||||||
|
@export var defib : DefibCutter
|
||||||
|
@export var animator_background : AnimationPlayer
|
||||||
|
@export var speaker_pan : AudioStreamPlayer2D
|
||||||
|
@export var socketArray: Array[CameraSocket]
|
||||||
|
|
||||||
|
@export var dur : float
|
||||||
|
@export var isPlayingSound : bool
|
||||||
|
var moving = false
|
||||||
|
var elapsed = 0
|
||||||
|
var currentPos : Vector3
|
||||||
|
var currentRot : Vector3
|
||||||
|
var currentFov : float
|
||||||
|
var activeIndex
|
||||||
|
var activeSocket : String
|
||||||
|
var pos_previous : Vector3
|
||||||
|
var rot_previous : Vector3
|
||||||
|
@export var anim_test : AnimationPlayer
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
LerpMovement()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func CutOutBackground():
|
||||||
|
animator_background.play("cut out")
|
||||||
|
func FadeInBackground():
|
||||||
|
animator_background.play("fade in")
|
||||||
|
|
||||||
|
func BeginLerp(lerpName : String):
|
||||||
|
#SavePrevious()
|
||||||
|
#speaker_pan.play()
|
||||||
|
PanSound()
|
||||||
|
activeSocket = lerpName
|
||||||
|
for i in range(socketArray.size()):
|
||||||
|
if (lerpName == socketArray[i].socketName):
|
||||||
|
activeIndex = i
|
||||||
|
currentPos = cam.transform.origin
|
||||||
|
currentRot = cam.rotation_degrees
|
||||||
|
currentFov = cam.fov
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func BeginLerpCutSegment():
|
||||||
|
PanSound()
|
||||||
|
activeSocket = "dealer cut shotgun"
|
||||||
|
for i in range(socketArray.size()):
|
||||||
|
if (activeSocket == socketArray[i].socketName):
|
||||||
|
activeIndex = i
|
||||||
|
currentPos = cam.transform.origin
|
||||||
|
currentRot = cam.rotation_degrees
|
||||||
|
currentFov = cam.fov
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func BeginLerpEnemy():
|
||||||
|
PanSound()
|
||||||
|
activeSocket = "enemy"
|
||||||
|
for i in range(socketArray.size()):
|
||||||
|
if (activeSocket == socketArray[i].socketName):
|
||||||
|
activeIndex = i
|
||||||
|
currentPos = cam.transform.origin
|
||||||
|
currentRot = cam.rotation_degrees
|
||||||
|
currentFov = cam.fov
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func PanSound():
|
||||||
|
var pitch = randf_range(.5, 1)
|
||||||
|
speaker_pan.pitch_scale = pitch
|
||||||
|
if (isPlayingSound): speaker_pan.play()
|
||||||
|
|
||||||
|
func SavePrevious():
|
||||||
|
rot_previous = cam.rotation_degrees
|
||||||
|
pos_previous = cam.transform.origin
|
||||||
|
|
||||||
|
func LerpMovement():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / dur, 0.0, 1.0)
|
||||||
|
c = ease(c, 0.2)
|
||||||
|
var pos = lerp(currentPos, socketArray[activeIndex].pos, c)
|
||||||
|
var rot = lerp(currentRot, socketArray[activeIndex].rot, c)
|
||||||
|
var fov = lerp(currentFov, socketArray[activeIndex].fov, c)
|
||||||
|
cam.fov = fov
|
||||||
|
cam.transform.origin = pos
|
||||||
|
cam.rotation_degrees = rot
|
||||||
|
pass
|
31
CameraShaker.gd
Normal file
31
CameraShaker.gd
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
class_name CameraShaker extends Node
|
||||||
|
|
||||||
|
@export var camera_to_shake : Camera3D
|
||||||
|
|
||||||
|
@export var intensity : float
|
||||||
|
@export var duration : float
|
||||||
|
var shake_timer = 0.0
|
||||||
|
var initial_h_offset = 0.0
|
||||||
|
var initial_v_offset = 0.0
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
if camera_to_shake:
|
||||||
|
initial_h_offset = camera_to_shake.h_offset
|
||||||
|
initial_v_offset = camera_to_shake.v_offset
|
||||||
|
|
||||||
|
func Shake():
|
||||||
|
if camera_to_shake:
|
||||||
|
shake_timer = duration
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if shake_timer > 0:
|
||||||
|
if camera_to_shake:
|
||||||
|
var h_offset = randf() * intensity - intensity / 2.0
|
||||||
|
var v_offset = randf() * intensity - intensity / 2.0
|
||||||
|
camera_to_shake.h_offset = initial_h_offset + h_offset
|
||||||
|
camera_to_shake.v_offset = initial_v_offset + v_offset
|
||||||
|
shake_timer -= delta
|
||||||
|
else:
|
||||||
|
if camera_to_shake:
|
||||||
|
camera_to_shake.h_offset = initial_h_offset
|
||||||
|
camera_to_shake.v_offset = initial_v_offset
|
6
CameraSocket.gd
Normal file
6
CameraSocket.gd
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class_name CameraSocket extends Resource
|
||||||
|
|
||||||
|
@export var socketName : String
|
||||||
|
@export var pos : Vector3
|
||||||
|
@export var rot : Vector3
|
||||||
|
@export var fov : float
|
49
CompartmentManager.gd
Normal file
49
CompartmentManager.gd
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
class_name CompartmentManager extends Node
|
||||||
|
|
||||||
|
@export var animator_compartment : AnimationPlayer
|
||||||
|
@export var animator_briefcase : AnimationPlayer
|
||||||
|
@export var speaker_briefcase : AudioStreamPlayer2D
|
||||||
|
@export var speaker_main : AudioStreamPlayer2D
|
||||||
|
@export var soundArray_briefcase : Array[AudioStream]
|
||||||
|
@export var soundArray_main : Array[AudioStream]
|
||||||
|
var isHiding_items = true
|
||||||
|
|
||||||
|
var toggle = false
|
||||||
|
var toggle2 = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
animator_compartment.play("RESET")
|
||||||
|
animator_briefcase.play("RESET")
|
||||||
|
|
||||||
|
func PlaySound_ShowBriefcase():
|
||||||
|
speaker_briefcase.stream = soundArray_briefcase[0]
|
||||||
|
speaker_briefcase.play()
|
||||||
|
|
||||||
|
func PlaySound_HideBriefcase():
|
||||||
|
speaker_briefcase.stream = soundArray_briefcase[1]
|
||||||
|
speaker_briefcase.play()
|
||||||
|
|
||||||
|
func PlaySound_ClearItems():
|
||||||
|
speaker_main.stream = soundArray_main[0]
|
||||||
|
speaker_main.play()
|
||||||
|
|
||||||
|
func PlaySound_ShowItems():
|
||||||
|
speaker_main.stream = soundArray_main[1]
|
||||||
|
speaker_main.play()
|
||||||
|
|
||||||
|
func PlaySound_HideItems():
|
||||||
|
speaker_main.stream = soundArray_main[2]
|
||||||
|
speaker_main.play()
|
||||||
|
|
||||||
|
func CycleCompartment(alias : String):
|
||||||
|
match (alias):
|
||||||
|
"show items":
|
||||||
|
animator_compartment.play("show items")
|
||||||
|
isHiding_items = false
|
||||||
|
"hide items":
|
||||||
|
animator_compartment.play("hide items")
|
||||||
|
isHiding_items = true
|
||||||
|
"show briefcase":
|
||||||
|
animator_briefcase.play("show briefcase")
|
||||||
|
"hide briefcase":
|
||||||
|
animator_briefcase.play("hide briefcase")
|
27
CursorManager.gd
Normal file
27
CursorManager.gd
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
class_name CursorManager extends Node
|
||||||
|
|
||||||
|
@export var speaker : AudioStreamPlayer2D
|
||||||
|
@export var cursor_point : CompressedTexture2D
|
||||||
|
@export var cursor_hover : CompressedTexture2D
|
||||||
|
@export var cursor_invalid : CompressedTexture2D
|
||||||
|
var cursor_visible = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
SetCursor(false, false)
|
||||||
|
|
||||||
|
func SetCursor(isVisible : bool, playSound : bool):
|
||||||
|
if (playSound):
|
||||||
|
speaker.play()
|
||||||
|
if (isVisible):
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
|
cursor_visible = true
|
||||||
|
if (!isVisible):
|
||||||
|
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||||
|
cursor_visible = false
|
||||||
|
|
||||||
|
func SetCursorImage(alias : String):
|
||||||
|
match(alias):
|
||||||
|
"point": Input.set_custom_mouse_cursor(cursor_point, 0, Vector2(12, 0))
|
||||||
|
"hover": Input.set_custom_mouse_cursor(cursor_hover, 0, Vector2(9, 0))
|
||||||
|
"invalid": Input.set_custom_mouse_cursor(cursor_invalid, 0, Vector2(12, 0))
|
||||||
|
pass
|
283
DealerIntelligence.gd
Normal file
283
DealerIntelligence.gd
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
class_name DealerIntelligence extends Node
|
||||||
|
#ALTHOUGH THE CLASS NAME SUGGESTS THAT THE DEALER HAS INTELLIGENCE, AND IT'S TRUE THERE ARE MANY INTELLIGENT DEALERS,
|
||||||
|
#CONTRARY TO THOSE THIS ONE IS NOT. HERE THERE IS NO INTELLIGENCE. ONLY LAYERS, HEAPS AND CLUMPS OF SPAGHETTI JUMBLE CODE.
|
||||||
|
|
||||||
|
@export var hands : HandManager
|
||||||
|
@export var itemManager : ItemManager
|
||||||
|
@export var shellSpawner : ShellSpawner
|
||||||
|
@export var shellLoader : ShellLoader
|
||||||
|
@export var shotgunShooting : ShotgunShooting
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var animator_shotgun : AnimationPlayer
|
||||||
|
@export var animator_dealerHands : AnimationPlayer
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var ejectManager : ShellEjectManager
|
||||||
|
@export var healthCounter : HealthCounter
|
||||||
|
@export var death : DeathManager
|
||||||
|
@export var cameraShaker : CameraShaker
|
||||||
|
@export var smoke : SmokeController
|
||||||
|
@export var shellEject_dealer : ShellEjectManager
|
||||||
|
@export var speaker_dealerarrive : AudioStreamPlayer2D
|
||||||
|
@export var speaker_handCrack : AudioStreamPlayer2D
|
||||||
|
@export var soundArray_cracks : Array[AudioStream]
|
||||||
|
@export var speaker_checkHandcuffs : AudioStreamPlayer2D
|
||||||
|
@export var speaker_breakHandcuffs : AudioStreamPlayer2D
|
||||||
|
@export var speaker_giveHandcuffs : AudioStreamPlayer2D
|
||||||
|
@export var sound_dealerarrive : AudioStream
|
||||||
|
@export var sound_dealerarriveCuffed : AudioStream
|
||||||
|
@export var dealermesh_normal : VisualInstance3D
|
||||||
|
@export var dealermesh_crushed : VisualInstance3D
|
||||||
|
|
||||||
|
var dealerItemStringArray : Array[String]
|
||||||
|
var dealerAboutToBreakFree = false
|
||||||
|
var dealerCanGoAgain = false
|
||||||
|
var dealerHoldingShotgun = false
|
||||||
|
|
||||||
|
func DealerCheckHandCuffs():
|
||||||
|
var brokeFree = false
|
||||||
|
camera.BeginLerp("enemy cuffs close")
|
||||||
|
if (!dealerAboutToBreakFree):
|
||||||
|
await get_tree().create_timer(.3, false).timeout
|
||||||
|
speaker_checkHandcuffs.play()
|
||||||
|
animator_dealerHands.play("dealer check handcuffs")
|
||||||
|
await get_tree().create_timer(.7, false).timeout
|
||||||
|
brokeFree = false
|
||||||
|
else:
|
||||||
|
await get_tree().create_timer(.3, false).timeout
|
||||||
|
animator_dealerHands.play("dealer break cuffs") #replace with broke free anim
|
||||||
|
speaker_breakHandcuffs.play()
|
||||||
|
#await get_tree().create_timer(.7, false).timeout
|
||||||
|
brokeFree = true
|
||||||
|
roundManager.dealerCuffed = false
|
||||||
|
dealerAboutToBreakFree = false
|
||||||
|
dealerAboutToBreakFree = true
|
||||||
|
roundManager.ReturnFromCuffCheck(brokeFree)
|
||||||
|
|
||||||
|
func Animator_CheckHandcuffs():
|
||||||
|
speaker_checkHandcuffs.play()
|
||||||
|
|
||||||
|
func Animator_GiveHandcuffs():
|
||||||
|
speaker_giveHandcuffs.play()
|
||||||
|
|
||||||
|
func BeginDealerTurn():
|
||||||
|
mainLoopFinished = false
|
||||||
|
usingHandsaw = false
|
||||||
|
DealerChoice()
|
||||||
|
|
||||||
|
var dealerTarget = ""
|
||||||
|
var knownShell = ""
|
||||||
|
var dealerKnowsShell = false
|
||||||
|
var mainLoopFinished = false
|
||||||
|
var usingHandsaw = false
|
||||||
|
var dealerUsedItem = false
|
||||||
|
func DealerChoice():
|
||||||
|
var dealerWantsToUse = ""
|
||||||
|
var dealerFinishedUsingItems = false
|
||||||
|
var hasHandsaw = false
|
||||||
|
if (roundManager.requestedWireCut):
|
||||||
|
await(roundManager.defibCutter.CutWire(roundManager.wireToCut))
|
||||||
|
if (shellSpawner.sequenceArray.size() == 0):
|
||||||
|
roundManager.StartRound(true)
|
||||||
|
return
|
||||||
|
if (roundManager.shellSpawner.sequenceArray.size() == 1):
|
||||||
|
knownShell = shellSpawner.sequenceArray[0]
|
||||||
|
if (shellSpawner.sequenceArray[0] == "live"): knownShell = "live"
|
||||||
|
else: knownShell = "blank"
|
||||||
|
if (knownShell == "live"): dealerTarget = "player"
|
||||||
|
else: dealerTarget = "self"
|
||||||
|
dealerKnowsShell = true
|
||||||
|
for i in range(itemManager.itemArray_dealer.size()):
|
||||||
|
if (itemManager.itemArray_dealer[i] == "magnifying glass" && !dealerKnowsShell && shellSpawner.sequenceArray.size() != 1):
|
||||||
|
dealerWantsToUse = "magnifying glass"
|
||||||
|
if (shellSpawner.sequenceArray[0] == "live"): knownShell = "live"
|
||||||
|
else: knownShell = "blank"
|
||||||
|
if (knownShell == "live"): dealerTarget = "player"
|
||||||
|
else: dealerTarget = "self"
|
||||||
|
dealerKnowsShell = true
|
||||||
|
break
|
||||||
|
if (itemManager.itemArray_dealer[i] == "cigarettes"):
|
||||||
|
var breaking = false
|
||||||
|
if (roundManager.health_opponent < roundManager.roundArray[0].startingHealth):
|
||||||
|
dealerWantsToUse = "cigarettes"
|
||||||
|
breaking = true
|
||||||
|
if (breaking): break
|
||||||
|
if (itemManager.itemArray_dealer[i] == "beer" && knownShell != "live" && shellSpawner.sequenceArray.size() != 1):
|
||||||
|
dealerWantsToUse = "beer"
|
||||||
|
shellEject_dealer.FadeOutShell()
|
||||||
|
break
|
||||||
|
if (itemManager.itemArray_dealer[i] == "handcuffs" && roundManager.playerCuffed == false && shellSpawner.sequenceArray.size() != 1):
|
||||||
|
dealerWantsToUse = "handcuffs"
|
||||||
|
roundManager.playerCuffed = true
|
||||||
|
break
|
||||||
|
if (itemManager.itemArray_dealer[i] == "handsaw" && !roundManager.barrelSawedOff && knownShell == "live"):
|
||||||
|
dealerWantsToUse = "handsaw"
|
||||||
|
usingHandsaw = true
|
||||||
|
roundManager.barrelSawedOff = true
|
||||||
|
roundManager.currentShotgunDamage = 2
|
||||||
|
break
|
||||||
|
|
||||||
|
if (dealerWantsToUse == ""): mainLoopFinished = true
|
||||||
|
for i in range(itemManager.itemArray_dealer.size()):
|
||||||
|
if (itemManager.itemArray_dealer[i] == "handsaw"): hasHandsaw = true
|
||||||
|
if (mainLoopFinished && !usingHandsaw && hasHandsaw && !roundManager.barrelSawedOff && knownShell != "blank"):
|
||||||
|
var decision = CoinFlip()
|
||||||
|
if (decision == 0): dealerTarget = "self"
|
||||||
|
else:
|
||||||
|
dealerUsedItem = true
|
||||||
|
dealerTarget = "player"
|
||||||
|
dealerWantsToUse = "handsaw"
|
||||||
|
usingHandsaw = true
|
||||||
|
roundManager.barrelSawedOff = true
|
||||||
|
roundManager.currentShotgunDamage = 2
|
||||||
|
|
||||||
|
if (dealerWantsToUse != ""):
|
||||||
|
if (dealerHoldingShotgun):
|
||||||
|
animator_shotgun.play("enemy put down shotgun")
|
||||||
|
shellLoader.DealerHandsDropShotgun()
|
||||||
|
dealerHoldingShotgun = false
|
||||||
|
await get_tree().create_timer(.45, false).timeout
|
||||||
|
dealerUsedItem = true
|
||||||
|
if (roundManager.waitingForDealerReturn):
|
||||||
|
await get_tree().create_timer(1.8, false).timeout
|
||||||
|
roundManager.waitingForDealerReturn = false
|
||||||
|
await(hands.PickupItemFromTable(dealerWantsToUse))
|
||||||
|
#if (dealerWantsToUse == "handcuffs"): await get_tree().create_timer(.8, false).timeout #additional delay for initial player handcuff check (continues outside animation)
|
||||||
|
if (dealerWantsToUse == "cigarettes"): await get_tree().create_timer(1.1, false).timeout #additional delay for health update routine (called in aninator. continues outside animation)
|
||||||
|
itemManager.itemArray_dealer.erase(dealerWantsToUse)
|
||||||
|
itemManager.numberOfItemsGrabbed_enemy -= 1
|
||||||
|
DealerChoice()
|
||||||
|
return
|
||||||
|
if (dealerWantsToUse == ""): dealerFinishedUsingItems = true
|
||||||
|
if (roundManager.waitingForDealerReturn):
|
||||||
|
await get_tree().create_timer(1.8, false).timeout
|
||||||
|
if (!dealerHoldingShotgun && dealerFinishedUsingItems):
|
||||||
|
GrabShotgun()
|
||||||
|
await get_tree().create_timer(1.4 + .5 - 1, false).timeout
|
||||||
|
await get_tree().create_timer(1, false).timeout
|
||||||
|
if (dealerTarget == ""): ChooseWhoToShootRandomly()
|
||||||
|
else: Shoot(dealerTarget)
|
||||||
|
dealerTarget = ""
|
||||||
|
knownShell = ""
|
||||||
|
dealerKnowsShell = false
|
||||||
|
pass
|
||||||
|
|
||||||
|
func EndDealerTurn(canDealerGoAgain : bool):
|
||||||
|
dealerCanGoAgain = canDealerGoAgain
|
||||||
|
#USINGITEMS: ASSIGN DEALER CAN GO AGAIN FROM ITEMS HERE
|
||||||
|
#CHECK IF OUT OF HEALTH
|
||||||
|
var outOfHealth_player = roundManager.health_player == 0
|
||||||
|
var outOfHealth_enemy = roundManager.health_opponent == 0
|
||||||
|
var outOfHealth = outOfHealth_player or outOfHealth_enemy
|
||||||
|
if (outOfHealth):
|
||||||
|
#if (outOfHealth_player): roundManager.OutOfHealth("player")
|
||||||
|
if (outOfHealth_enemy): roundManager.OutOfHealth("dealer")
|
||||||
|
return
|
||||||
|
|
||||||
|
if (!dealerCanGoAgain):
|
||||||
|
EndTurnMain()
|
||||||
|
else:
|
||||||
|
if (shellSpawner.sequenceArray.size()):
|
||||||
|
BeginDealerTurn()
|
||||||
|
else:
|
||||||
|
EndTurnMain()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func ChooseWhoToShootRandomly():
|
||||||
|
var decision = CoinFlip()
|
||||||
|
if (decision == 0): Shoot("self")
|
||||||
|
else: Shoot("player")
|
||||||
|
|
||||||
|
func GrabShotgun():
|
||||||
|
#await get_tree().create_timer(1, false).timeout
|
||||||
|
#camera.BeginLerp("enemy")
|
||||||
|
#await get_tree().create_timer(.8, false).timeout
|
||||||
|
await(shellLoader.DealerHandsGrabShotgun())
|
||||||
|
await get_tree().create_timer(.2, false).timeout
|
||||||
|
animator_shotgun.play("grab shotgun_pointing enemy")
|
||||||
|
dealerHoldingShotgun = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func EndTurnMain():
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
if (dealerHoldingShotgun):
|
||||||
|
animator_shotgun.play("enemy put down shotgun")
|
||||||
|
shellLoader.DealerHandsDropShotgun()
|
||||||
|
dealerHoldingShotgun = false
|
||||||
|
roundManager.EndTurn(true)
|
||||||
|
|
||||||
|
func Shoot(who : String):
|
||||||
|
var currentRoundInChamber = shellSpawner.sequenceArray[0]
|
||||||
|
dealerCanGoAgain = false
|
||||||
|
var playerDied = false
|
||||||
|
var dealerDied = false
|
||||||
|
ejectManager.FadeOutShell()
|
||||||
|
#ANIMATION DEPENDING ON WHO IS SHOT
|
||||||
|
match(who):
|
||||||
|
"self":
|
||||||
|
await get_tree().create_timer(.2, false).timeout
|
||||||
|
animator_shotgun.play("enemy shoot self")
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
shotgunShooting.whoshot = "dealer"
|
||||||
|
shotgunShooting.PlayShootingSound()
|
||||||
|
pass
|
||||||
|
"player":
|
||||||
|
animator_shotgun.play("enemy shoot player")
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
shotgunShooting.whoshot = "player"
|
||||||
|
shotgunShooting.PlayShootingSound()
|
||||||
|
pass
|
||||||
|
#SUBTRACT HEALTH. ASSIGN DEALER CAN GO AGAIN. RETURN IF DEAD
|
||||||
|
if (currentRoundInChamber == "live" && who == "self"):
|
||||||
|
roundManager.health_opponent -= roundManager.currentShotgunDamage
|
||||||
|
if (roundManager.health_opponent < 0): roundManager.health_opponent = 0
|
||||||
|
smoke.SpawnSmoke("barrel")
|
||||||
|
cameraShaker.Shake()
|
||||||
|
dealerCanGoAgain = false
|
||||||
|
death.Kill("dealer", false, true)
|
||||||
|
return
|
||||||
|
if (currentRoundInChamber == "live" && who == "player"):
|
||||||
|
roundManager.health_player -= roundManager.currentShotgunDamage
|
||||||
|
if (roundManager.health_player < 0): roundManager.health_player = 0
|
||||||
|
cameraShaker.Shake()
|
||||||
|
smoke.SpawnSmoke("barrel")
|
||||||
|
await(death.Kill("player", false, false))
|
||||||
|
playerDied = true
|
||||||
|
if (currentRoundInChamber == "blank" && who == "self"): dealerCanGoAgain = true
|
||||||
|
#EJECTING SHELLS
|
||||||
|
await get_tree().create_timer(.4, false).timeout
|
||||||
|
if (who == "player"): animator_shotgun.play("enemy eject shell_from player")
|
||||||
|
if (who == "self"): animator_shotgun.play("enemy eject shell_from self")
|
||||||
|
await get_tree().create_timer(1.7, false).timeout
|
||||||
|
#shellSpawner.sequenceArray.remove_at(0)
|
||||||
|
EndDealerTurn(dealerCanGoAgain)
|
||||||
|
|
||||||
|
func Speaker_DealerArrive():
|
||||||
|
var p = randf_range(.9, 1.0)
|
||||||
|
speaker_dealerarrive.pitch_scale = p
|
||||||
|
speaker_dealerarrive.stream = sound_dealerarrive
|
||||||
|
speaker_dealerarrive.play()
|
||||||
|
|
||||||
|
func Speaker_DealerArrive_Cuffed():
|
||||||
|
var p = randf_range(.9, 1.0)
|
||||||
|
speaker_dealerarrive.pitch_scale = p
|
||||||
|
speaker_dealerarrive.stream = sound_dealerarriveCuffed
|
||||||
|
speaker_dealerarrive.play()
|
||||||
|
|
||||||
|
func Speaker_HandCrack():
|
||||||
|
var randindex = randi_range(0, soundArray_cracks.size() - 1)
|
||||||
|
speaker_handCrack.stream = soundArray_cracks[randindex]
|
||||||
|
speaker_handCrack.play()
|
||||||
|
|
||||||
|
var swapped = false
|
||||||
|
func SwapDealerMesh():
|
||||||
|
if (!swapped):
|
||||||
|
dealermesh_normal.set_layer_mask_value(1, false)
|
||||||
|
dealermesh_crushed.set_layer_mask_value(1, true)
|
||||||
|
swapped = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func CoinFlip():
|
||||||
|
var result = randi_range(0, 1)
|
||||||
|
return result
|
||||||
|
pass
|
136
DeathManager.gd
Normal file
136
DeathManager.gd
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
class_name DeathManager extends Node
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
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 MainDeathRoutine():
|
||||||
|
var loadingHeaven = false
|
||||||
|
if(shotgunShooting.roundManager.wireIsCut_player):
|
||||||
|
shotgunShooting.roundManager.playerData.enteringFromTrueDeath = true
|
||||||
|
loadingHeaven = true
|
||||||
|
shotgunShooting.roundManager.playerData.playerEnteringFromDeath = true
|
||||||
|
savefile.SaveGame()
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
if (!loadingHeaven): get_tree().change_scene_to_file("res://scenes/death.tscn")
|
||||||
|
else: 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)
|
22
DecisionTextManager.gd
Normal file
22
DecisionTextManager.gd
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
class_name DecisionTextManager extends Node
|
||||||
|
|
||||||
|
@export var textArray : Array[TextInteraction]
|
||||||
|
@export var colliderArray : Array[StaticBody3D]
|
||||||
|
@export var animator : AnimationPlayer
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
for i in range(colliderArray.size()):
|
||||||
|
colliderArray[i].collision_layer = 0
|
||||||
|
colliderArray[i].collision_mask = 0
|
||||||
|
|
||||||
|
func SetUI(state : bool):
|
||||||
|
if (state):
|
||||||
|
for i in range(colliderArray.size()):
|
||||||
|
colliderArray[i].collision_layer = 1
|
||||||
|
colliderArray[i].collision_mask = 1
|
||||||
|
animator.play("show text")
|
||||||
|
else:
|
||||||
|
for i in range(colliderArray.size()):
|
||||||
|
colliderArray[i].collision_layer = 0
|
||||||
|
colliderArray[i].collision_mask = 0
|
||||||
|
animator.play("hide text")
|
17
DefibBlade.gd
Normal file
17
DefibBlade.gd
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
class_name DefibBlade extends Node
|
||||||
|
|
||||||
|
@export var anim : AnimationPlayer
|
||||||
|
@export var speaker : AudioStreamPlayer2D
|
||||||
|
@export var sound_open : AudioStream
|
||||||
|
@export var sound_close : AudioStream
|
||||||
|
@export var wire_normal : Node3D
|
||||||
|
@export var wire_broken : Node3D
|
||||||
|
|
||||||
|
func Blade(state : String, playSound : bool):
|
||||||
|
anim.play(state)
|
||||||
|
if (state == "open"): speaker.stream = sound_open
|
||||||
|
else:
|
||||||
|
speaker.stream = sound_close
|
||||||
|
wire_normal.visible = false
|
||||||
|
wire_broken.visible = true
|
||||||
|
if (playSound): speaker.play()
|
161
DefibCutter.gd
Normal file
161
DefibCutter.gd
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
class_name DefibCutter extends Node
|
||||||
|
|
||||||
|
@export var cam : CameraManager
|
||||||
|
@export var dia : Dialogue
|
||||||
|
@export var animator_main : AnimationPlayer
|
||||||
|
@export var consoleArray : Array[Node3D]
|
||||||
|
@export var speaker_motor : AudioStreamPlayer2D
|
||||||
|
@export var speaker_bootup : AudioStreamPlayer2D
|
||||||
|
@export var speaker_beep : AudioStreamPlayer2D
|
||||||
|
@export var speaker_blademove : AudioStreamPlayer2D
|
||||||
|
@export var blade_player : DefibBlade
|
||||||
|
@export var blade_dealer : DefibBlade
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var errorUI_player : Node3D
|
||||||
|
@export var errorUI_dealer : Node3D
|
||||||
|
@export var speaker_error : AudioStreamPlayer2D
|
||||||
|
@export var soundArray_error : Array[AudioStream]
|
||||||
|
@export var healthUI_player : Node3D
|
||||||
|
@export var healthUI_dealer : Node3D
|
||||||
|
@export var healthUI_divider : Node3D
|
||||||
|
|
||||||
|
var cutDialogueSent = false
|
||||||
|
|
||||||
|
func InitialSetup():
|
||||||
|
cam.BeginLerp("defib setup")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
animator_main.play("initial setup")
|
||||||
|
speaker_motor.play()
|
||||||
|
await get_tree().create_timer(3.6, false).timeout
|
||||||
|
cam.BeginLerp("defib console")
|
||||||
|
speaker_bootup.play()
|
||||||
|
await get_tree().create_timer(1.9, false).timeout
|
||||||
|
for i in range(consoleArray.size()):
|
||||||
|
consoleArray[i].visible = true
|
||||||
|
speaker_beep.pitch_scale = randf_range(.8, 1.0)
|
||||||
|
speaker_beep.play()
|
||||||
|
await get_tree().create_timer(.09, false).timeout
|
||||||
|
await get_tree().create_timer(.4, false).timeout
|
||||||
|
cam.BeginLerp("defib setup")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
blade_player.Blade("open", true)
|
||||||
|
blade_dealer.Blade("open", false)
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
animator_main.play("main setup")
|
||||||
|
speaker_blademove.play()
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
cam.BeginLerp("defib blade insert")
|
||||||
|
await get_tree().create_timer(1.8, false).timeout
|
||||||
|
cam.BeginLerp("home")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
|
||||||
|
func CutWire(who : String):
|
||||||
|
var tempwho = who
|
||||||
|
var origsocket = cam.activeSocket
|
||||||
|
cam.BeginLerp("enemy")
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
if (!cutDialogueSent):
|
||||||
|
dia.ShowText_Forever("ARE YOU READY?")
|
||||||
|
await get_tree().create_timer(4, false).timeout
|
||||||
|
dia.HideText()
|
||||||
|
await get_tree().create_timer(.2, false).timeout
|
||||||
|
cutDialogueSent = true
|
||||||
|
cam.BeginLerp("defib blade insert")
|
||||||
|
await get_tree().create_timer(1, false).timeout
|
||||||
|
if (who == "player"): blade_player.Blade("close", true)
|
||||||
|
if (who == "dealer"): blade_dealer.Blade("close", true)
|
||||||
|
roundManager.requestedWireCut = false
|
||||||
|
roundManager.wireToCut = ""
|
||||||
|
await get_tree().create_timer(.05, false).timeout
|
||||||
|
BreakDisplay(tempwho)
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
cam.BeginLerp("health counter")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
FlashError(tempwho)
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
cam.BeginLerp(origsocket)
|
||||||
|
await get_tree().create_timer(1, false).timeout
|
||||||
|
|
||||||
|
#.36
|
||||||
|
func FlashError(who : String):
|
||||||
|
var act = null
|
||||||
|
if (who == "player"): act = errorUI_player
|
||||||
|
else: act = errorUI_dealer
|
||||||
|
act.visible = true
|
||||||
|
PlayError()
|
||||||
|
await get_tree().create_timer(.05, false).timeout
|
||||||
|
act.visible = false
|
||||||
|
await get_tree().create_timer(.05, false).timeout
|
||||||
|
act.visible = true
|
||||||
|
PlayError()
|
||||||
|
await get_tree().create_timer(.11, false).timeout
|
||||||
|
act.visible = false
|
||||||
|
await get_tree().create_timer(.05, false).timeout
|
||||||
|
act.visible = true
|
||||||
|
PlayError()
|
||||||
|
await get_tree().create_timer(.05, false).timeout
|
||||||
|
act.visible = false
|
||||||
|
PlayError()
|
||||||
|
|
||||||
|
func BlipError(who : String):
|
||||||
|
var act = null
|
||||||
|
if (who == "player"): act = errorUI_player
|
||||||
|
else: act = errorUI_dealer
|
||||||
|
act.visible = true
|
||||||
|
PlayError()
|
||||||
|
await get_tree().create_timer(.05, false).timeout
|
||||||
|
act.visible = false
|
||||||
|
await get_tree().create_timer(.05, false).timeout
|
||||||
|
act.visible = true
|
||||||
|
PlayError()
|
||||||
|
await get_tree().create_timer(.11, false).timeout
|
||||||
|
act.visible = false
|
||||||
|
PlayError()
|
||||||
|
|
||||||
|
func BlipError_Both():
|
||||||
|
errorUI_dealer.visible = true
|
||||||
|
errorUI_player.visible = true
|
||||||
|
PlayError()
|
||||||
|
await get_tree().create_timer(.05, false).timeout
|
||||||
|
errorUI_dealer.visible = false
|
||||||
|
errorUI_player.visible = false
|
||||||
|
await get_tree().create_timer(.05, false).timeout
|
||||||
|
errorUI_dealer.visible = true
|
||||||
|
errorUI_player.visible = true
|
||||||
|
PlayError()
|
||||||
|
await get_tree().create_timer(.11, false).timeout
|
||||||
|
errorUI_dealer.visible = false
|
||||||
|
errorUI_player.visible = false
|
||||||
|
PlayError()
|
||||||
|
|
||||||
|
var displayBroken_player = false
|
||||||
|
var displayBroken_dealer = false
|
||||||
|
func BreakDisplay(who : String):
|
||||||
|
if (who == "player"):
|
||||||
|
healthUI_player.visible = false
|
||||||
|
displayBroken_player = true
|
||||||
|
else:
|
||||||
|
healthUI_dealer.visible = false
|
||||||
|
displayBroken_dealer = true
|
||||||
|
if (displayBroken_dealer && displayBroken_player):
|
||||||
|
healthUI_divider.visible = false
|
||||||
|
|
||||||
|
func PlayError():
|
||||||
|
var index = randi_range(0, soundArray_error.size() - 1)
|
||||||
|
var s = soundArray_error[index]
|
||||||
|
speaker_error.stream = s
|
||||||
|
speaker_error.play()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
61
DescriptionManager.gd
Normal file
61
DescriptionManager.gd
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
class_name DescriptionManager extends Node
|
||||||
|
|
||||||
|
@export var interaction : InteractionManager
|
||||||
|
@export var uiArray : Array[Label]
|
||||||
|
@export var dur : float
|
||||||
|
|
||||||
|
var elapsed
|
||||||
|
var moving = false
|
||||||
|
var current_opacity = 0.0
|
||||||
|
var next_opacity = 1.0
|
||||||
|
|
||||||
|
var started = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
HideText()
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
LerpText()
|
||||||
|
CheckInteraction()
|
||||||
|
|
||||||
|
func HideText():
|
||||||
|
for i in range(uiArray.size()):
|
||||||
|
uiArray[i].modulate.a = 0
|
||||||
|
pass
|
||||||
|
|
||||||
|
func CheckInteraction():
|
||||||
|
if (interaction.activeParent != null):
|
||||||
|
var childArray = interaction.activeParent.get_children()
|
||||||
|
var found = false
|
||||||
|
for i in range(childArray.size()):
|
||||||
|
if (childArray[i] is PickupIndicator):
|
||||||
|
found = true
|
||||||
|
return
|
||||||
|
if (!found && started):
|
||||||
|
EndLerp()
|
||||||
|
started = false
|
||||||
|
|
||||||
|
func BeginLerp():
|
||||||
|
started = true
|
||||||
|
current_opacity = uiArray[0].modulate.a
|
||||||
|
next_opacity = 1.0
|
||||||
|
elapsed = 0.0
|
||||||
|
moving = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func EndLerp():
|
||||||
|
current_opacity = uiArray[0].modulate.a
|
||||||
|
next_opacity = 0.0
|
||||||
|
elapsed = 0.0
|
||||||
|
moving = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func LerpText():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / dur, 0.0, 1.0)
|
||||||
|
var opacity = lerp(current_opacity, next_opacity, c)
|
||||||
|
for i in range(uiArray.size()):
|
||||||
|
var color = Color(uiArray[i].modulate.r, uiArray[i].modulate.g, uiArray[i].modulate.b, opacity)
|
||||||
|
uiArray[i].modulate = color
|
||||||
|
pass
|
59
DialogueManager.gd
Normal file
59
DialogueManager.gd
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
class_name Dialogue extends Node
|
||||||
|
|
||||||
|
@export var speaker_click : AudioStreamPlayer2D
|
||||||
|
@export var soundArray_clicks : Array[AudioStream]
|
||||||
|
@export var dialogueUI : Label
|
||||||
|
@export var dialogueUI_backdrop : ColorRect
|
||||||
|
@export var dialogueSpeed : float
|
||||||
|
@export var incrementDelay : float
|
||||||
|
|
||||||
|
var dealerLowPitched = false
|
||||||
|
var elapsed = 0
|
||||||
|
var moving = false
|
||||||
|
var looping = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
speaker_click.stream = soundArray_clicks[3]
|
||||||
|
|
||||||
|
func ShowText_ForDuration(activeText : String, showDuration : float):
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible_characters = 0
|
||||||
|
dialogueUI.text = activeText
|
||||||
|
dialogueUI.visible = true
|
||||||
|
dialogueUI_backdrop.visible = true
|
||||||
|
looping = true
|
||||||
|
TickText()
|
||||||
|
await get_tree().create_timer(showDuration, false).timeout
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible = false
|
||||||
|
dialogueUI_backdrop.visible = false
|
||||||
|
|
||||||
|
func ShowText_Forever(activeText : String):
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible_characters = 0
|
||||||
|
dialogueUI.text = activeText
|
||||||
|
dialogueUI.visible = true
|
||||||
|
dialogueUI_backdrop.visible = true
|
||||||
|
looping = true
|
||||||
|
TickText()
|
||||||
|
|
||||||
|
func ShowDealerInspectionText():
|
||||||
|
ShowText_Forever("VERY INTERESTING ...")
|
||||||
|
|
||||||
|
func HideText():
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible = false
|
||||||
|
dialogueUI_backdrop.visible = false
|
||||||
|
pass
|
||||||
|
|
||||||
|
func TickText():
|
||||||
|
while(looping):
|
||||||
|
dialogueUI.visible_characters += 1
|
||||||
|
if (!dealerLowPitched): speaker_click.pitch_scale = randf_range(0.5, .6)
|
||||||
|
else: speaker_click.pitch_scale = randf_range(.2, .3)
|
||||||
|
speaker_click.play()
|
||||||
|
if (dialogueUI.visible_ratio >= 1):
|
||||||
|
looping = false
|
||||||
|
await get_tree().create_timer(incrementDelay, false).timeout
|
||||||
|
pass
|
||||||
|
pass
|
38
DialogueManager_Ending.gd
Normal file
38
DialogueManager_Ending.gd
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
class_name DialogueEnding extends Node
|
||||||
|
|
||||||
|
@export var speaker_click : AudioStreamPlayer2D
|
||||||
|
@export var soundArray_clicks : Array[AudioStream]
|
||||||
|
@export var dialogueUI : Label
|
||||||
|
@export var dialogueSpeed : float
|
||||||
|
@export var incrementDelay : float
|
||||||
|
|
||||||
|
var elapsed = 0
|
||||||
|
var moving = false
|
||||||
|
var looping = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
speaker_click.stream = soundArray_clicks[0]
|
||||||
|
|
||||||
|
func ShowText_Forever(activeText : String):
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible_characters = 0
|
||||||
|
dialogueUI.text = activeText
|
||||||
|
dialogueUI.visible = true
|
||||||
|
looping = true
|
||||||
|
TickText()
|
||||||
|
|
||||||
|
func HideText():
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible = false
|
||||||
|
pass
|
||||||
|
|
||||||
|
func TickText():
|
||||||
|
while(looping):
|
||||||
|
dialogueUI.visible_characters += 1
|
||||||
|
speaker_click.pitch_scale = randf_range(.8, 1)
|
||||||
|
speaker_click.play()
|
||||||
|
if (dialogueUI.visible_ratio >= 1):
|
||||||
|
looping = false
|
||||||
|
await get_tree().create_timer(incrementDelay, false).timeout
|
||||||
|
pass
|
||||||
|
pass
|
142
EndingManager.gd
Normal file
142
EndingManager.gd
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
class_name EndingManager extends Node
|
||||||
|
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var pp : WorldEnvironment
|
||||||
|
@export var animator_cam : AnimationPlayer
|
||||||
|
@export var animator_backdrop : AnimationPlayer
|
||||||
|
@export var cam : CameraManager
|
||||||
|
@export var blockout : Array[Node3D]
|
||||||
|
@export var viewblocker : ColorRect
|
||||||
|
@export var animator_viewblocker : AnimationPlayer
|
||||||
|
@export var animator_streetlights : AnimationPlayer
|
||||||
|
@export var music_ending : AudioStreamPlayer2D
|
||||||
|
@export var dia : DialogueEnding
|
||||||
|
@export var label_congrats : Label
|
||||||
|
@export var label_array : Array[Label]
|
||||||
|
@export var uiparent : Control
|
||||||
|
@export var animator_congrats : AnimationPlayer
|
||||||
|
@export var animator_cash : AnimationPlayer
|
||||||
|
@export var fireArray : Array[TextFire]
|
||||||
|
@export var speaker_load : AudioStreamPlayer2D
|
||||||
|
@export var speaker_ambience : AudioStreamPlayer2D
|
||||||
|
@export var cntrl_ambience : SpeakerController
|
||||||
|
@export var cntrl_endingmusic : SpeakerController
|
||||||
|
@export var animator_anykey : AnimationPlayer
|
||||||
|
@export var animator_pan : AnimationPlayer
|
||||||
|
var waitingForInput = false
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventKey and event.pressed:
|
||||||
|
if (waitingForInput):
|
||||||
|
ExitGame()
|
||||||
|
waitingForInput = false
|
||||||
|
|
||||||
|
func BeginEnding():
|
||||||
|
cam.moving = false
|
||||||
|
animator_pan.play("pan to brief")
|
||||||
|
music_ending.play()
|
||||||
|
AmbienceFade()
|
||||||
|
await get_tree().create_timer(10.67, false).timeout
|
||||||
|
viewblocker.visible = true
|
||||||
|
animator_viewblocker.play("snap")
|
||||||
|
animator_pan.stop()
|
||||||
|
SetupEnding()
|
||||||
|
FinalScore()
|
||||||
|
for l in label_array: l.visible = false
|
||||||
|
label_congrats.visible = false
|
||||||
|
await get_tree().create_timer(1.2, false).timeout
|
||||||
|
animator_viewblocker.play("fade out")
|
||||||
|
await get_tree().create_timer(6, false).timeout
|
||||||
|
#SHOW UI
|
||||||
|
label_congrats.visible = true
|
||||||
|
animator_congrats.play("wobble it")
|
||||||
|
animator_cash.play("wobble it")
|
||||||
|
dia.ShowText_Forever(glob_text_congratulations)
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
for i in fireArray:
|
||||||
|
speaker_load.pitch_scale = randf_range(.95, 1)
|
||||||
|
speaker_load.play()
|
||||||
|
await get_tree().create_timer(.15, false).timeout
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
for i in range(fireArray.size()):
|
||||||
|
if (i == 5):
|
||||||
|
await get_tree().create_timer(.4, false).timeout
|
||||||
|
fireArray[i].changed = true
|
||||||
|
fireArray[i].speaker.pitch_scale = .15
|
||||||
|
fireArray[i].Fire()
|
||||||
|
await get_tree().create_timer(.33, false).timeout
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
GetInput()
|
||||||
|
|
||||||
|
func GetInput():
|
||||||
|
animator_anykey.play("flicker")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
waitingForInput = true
|
||||||
|
|
||||||
|
func ExitGame():
|
||||||
|
animator_viewblocker.play("fade in")
|
||||||
|
cntrl_endingmusic.FadeOut()
|
||||||
|
cntrl_ambience.fadeDuration = 3
|
||||||
|
cntrl_ambience.FadeOut()
|
||||||
|
isActive = false
|
||||||
|
await get_tree().create_timer(4, false).timeout
|
||||||
|
get_tree().quit()
|
||||||
|
|
||||||
|
var isActive = true
|
||||||
|
func AmbienceFade():
|
||||||
|
await get_tree().create_timer(55, false).timeout
|
||||||
|
if (isActive):
|
||||||
|
cntrl_ambience.SnapVolume(false)
|
||||||
|
speaker_ambience.play()
|
||||||
|
cntrl_ambience.FadeIn()
|
||||||
|
|
||||||
|
func SetupEnding():
|
||||||
|
await get_tree().create_timer(.1, false).timeout
|
||||||
|
uiparent.visible = true
|
||||||
|
for b in blockout: b.visible = true
|
||||||
|
pp.environment.adjustment_brightness = 5.68
|
||||||
|
pp.environment.adjustment_contrast = 1.3
|
||||||
|
pp.environment.adjustment_saturation = .26
|
||||||
|
cam.moving = false
|
||||||
|
cam.cam.fov = 60
|
||||||
|
animator_streetlights.play("looping")
|
||||||
|
animator_backdrop.play("loop exterior")
|
||||||
|
animator_cam.play("camera loop car")
|
||||||
|
|
||||||
|
var glob_text_congratulations
|
||||||
|
func FinalScore():
|
||||||
|
var playername = roundManager.playerData.playername
|
||||||
|
var shots_fired = roundManager.playerData.stat_shotsFired
|
||||||
|
var shells_ejected = roundManager.playerData.stat_shellsEjected
|
||||||
|
var doors_kicked = roundManager.playerData.stat_doorsKicked
|
||||||
|
var cigarettes_smoked = roundManager.playerData.stat_cigSmoked
|
||||||
|
var ml_of_beer_drank = roundManager.playerData.stat_beerDrank
|
||||||
|
var max_cash = 70000
|
||||||
|
|
||||||
|
var cancer_bills = cigarettes_smoked * 220
|
||||||
|
var new_leg_bones_price = doors_kicked * 1000
|
||||||
|
var DUI_fine = ml_of_beer_drank * 1.5
|
||||||
|
var total_cash = max_cash - cancer_bills - DUI_fine
|
||||||
|
if (doors_kicked > 2): total_cash -= new_leg_bones_price
|
||||||
|
if (total_cash < 0): total_cash = 0
|
||||||
|
|
||||||
|
#if (playername == "sex"): total_cash = 69
|
||||||
|
#if (playername == "leet"): total_cash = 1337
|
||||||
|
#if (playername == "snoop" or playername == "weed" or playername == "kush"): total_cash = 420
|
||||||
|
|
||||||
|
var text_congratulations = "CONGRATULATIONS, " + playername + "!"
|
||||||
|
var text_shotsFired = "shots fired ........ " + str(shots_fired)
|
||||||
|
var text_shellsEjected = "shells ejected ..... " + str(shells_ejected)
|
||||||
|
var text_doorsKicked = "doors kicked ....... " + str(doors_kicked)
|
||||||
|
var text_cigSmoked = "cigarettes smoked .. " + str(cigarettes_smoked)
|
||||||
|
var text_beerDrank = "ml of beer drank ... " + str(ml_of_beer_drank)
|
||||||
|
var text_totalcash = "total cash: " + str(total_cash) + " $"
|
||||||
|
|
||||||
|
glob_text_congratulations = text_congratulations
|
||||||
|
|
||||||
|
label_array[0].text = text_shotsFired
|
||||||
|
label_array[1].text = text_shellsEjected
|
||||||
|
label_array[2].text = text_doorsKicked
|
||||||
|
label_array[3].text = text_cigSmoked
|
||||||
|
label_array[4].text = text_beerDrank
|
||||||
|
label_array[5].text = text_totalcash
|
38
FilterController.gd
Normal file
38
FilterController.gd
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
class_name FilterController extends Node
|
||||||
|
|
||||||
|
@export var panDuration : float
|
||||||
|
@export var lowPassDefaultValue : float
|
||||||
|
@export var lowPassMaxValue : float
|
||||||
|
|
||||||
|
var effect_lowPass
|
||||||
|
var moving = false
|
||||||
|
var elapsed = 0
|
||||||
|
var begin
|
||||||
|
var dest
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
effect_lowPass = AudioServer.get_bus_effect(1, 0)
|
||||||
|
effect_lowPass.cutoff_hz = lowPassDefaultValue
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
PanLowPass_HighLow()
|
||||||
|
|
||||||
|
func BeginSnap(valueTo : float):
|
||||||
|
moving = false
|
||||||
|
elapsed = 0
|
||||||
|
effect_lowPass.cutoff_hz = valueTo
|
||||||
|
|
||||||
|
func BeginPan(valueFrom : float, valueTo : float):
|
||||||
|
moving = false
|
||||||
|
elapsed = 0
|
||||||
|
begin = valueFrom
|
||||||
|
dest = valueTo
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func PanLowPass_HighLow():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / panDuration, 0.0, 1.0)
|
||||||
|
c = ease(c, 0.4)
|
||||||
|
var panValue = lerpf(begin, dest, c)
|
||||||
|
effect_lowPass.cutoff_hz = panValue
|
4
GameOverManager.gd
Normal file
4
GameOverManager.gd
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class_name GameOverManager extends Node
|
||||||
|
|
||||||
|
func PlayerWon():
|
||||||
|
get_tree().change_scene_to_file("res://scenes/win.tscn")
|
183
HandManager.gd
Normal file
183
HandManager.gd
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
class_name HandManager extends Node
|
||||||
|
|
||||||
|
@export var dealerAI : DealerIntelligence
|
||||||
|
@export var itemManager : ItemManager
|
||||||
|
@export var animator_hands : AnimationPlayer
|
||||||
|
@export var animator_dealerHeadLook : AnimationPlayer
|
||||||
|
@export var handArray_L : Array[Node3D]
|
||||||
|
@export var handArray_R : Array[Node3D]
|
||||||
|
@export var gridOffsetArray : Array[Vector3] #ITEM'S ACTIVE GRID INDEX STORED IN PICKUP INDICATOR: dealerGridIndex
|
||||||
|
|
||||||
|
@export var handParent_L : Node3D
|
||||||
|
@export var handParent_R : Node3D
|
||||||
|
@export var hand_defaultL : Node3D
|
||||||
|
@export var hand_defaultR : Node3D
|
||||||
|
@export var hand_cigarettepack : Node3D #L
|
||||||
|
@export var hand_beer : Node3D #L
|
||||||
|
@export var hand_handcuffs : Node3D #R
|
||||||
|
@export var hand_handsaw : Node3D #R
|
||||||
|
@export var hand_magnifier : Node3D #R
|
||||||
|
|
||||||
|
@export var lerpDuration : float
|
||||||
|
@export var handRot_left : Vector3 #hand rotation when grabing from left grids
|
||||||
|
@export var handRot_right : Vector3 #same shit
|
||||||
|
@export var parentOriginal_posL : Vector3
|
||||||
|
@export var parentOriginal_rotL : Vector3
|
||||||
|
@export var parentOriginal_posR : Vector3
|
||||||
|
@export var parentOriginal_rotR : Vector3
|
||||||
|
var moving = false
|
||||||
|
var lerping_L = false
|
||||||
|
var lerping_R = false
|
||||||
|
var pos_current
|
||||||
|
var pos_next
|
||||||
|
var rot_current
|
||||||
|
var rot_next
|
||||||
|
var elapsed = 0
|
||||||
|
var orig_pos
|
||||||
|
var orig_rot
|
||||||
|
var activeHandParent
|
||||||
|
var activeItemToGrab
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
LerpHandMovement()
|
||||||
|
|
||||||
|
func PickupItemFromTable(itemName : String):
|
||||||
|
dealerAI.Speaker_HandCrack()
|
||||||
|
var activeIndex
|
||||||
|
var activeInstance
|
||||||
|
var whichHandToGrabWith
|
||||||
|
var whichGridSide
|
||||||
|
var matchIndex
|
||||||
|
activeItemToGrab = itemName
|
||||||
|
for i in range(itemManager.itemArray_instances_dealer.size()):
|
||||||
|
if (itemName == itemManager.itemArray_instances_dealer[i].get_child(1).itemName):
|
||||||
|
activeInstance = itemManager.itemArray_instances_dealer[i]
|
||||||
|
matchIndex = i
|
||||||
|
break
|
||||||
|
activeIndex = activeInstance.get_child(0).dealerGridIndex
|
||||||
|
ToggleHandVisible("BOTH", false)
|
||||||
|
hand_defaultL.visible = true
|
||||||
|
hand_defaultR.visible = true
|
||||||
|
if (itemName == "beer" or itemName == "cigarettes"): whichHandToGrabWith = "left"
|
||||||
|
else: whichHandToGrabWith = "right"
|
||||||
|
whichGridSide = activeInstance.get_child(0).whichSide
|
||||||
|
animator_hands.play("RESET")
|
||||||
|
BeginHandLerp(whichHandToGrabWith, activeIndex, whichGridSide)
|
||||||
|
if (whichGridSide == "right"): animator_dealerHeadLook.play("dealer look right")
|
||||||
|
else: animator_dealerHeadLook.play("dealer look left")
|
||||||
|
await get_tree().create_timer(lerpDuration -.4, false).timeout
|
||||||
|
if (whichHandToGrabWith == "right"): hand_defaultR.visible = false
|
||||||
|
else: hand_defaultL.visible = false
|
||||||
|
dealerAI.Speaker_HandCrack()
|
||||||
|
match (itemName):
|
||||||
|
"handsaw":
|
||||||
|
hand_handsaw.visible = true
|
||||||
|
"magnifying glass":
|
||||||
|
hand_magnifier.visible = true
|
||||||
|
"handcuffs":
|
||||||
|
hand_handcuffs.visible = true
|
||||||
|
"cigarettes":
|
||||||
|
hand_cigarettepack.visible = true
|
||||||
|
itemManager.numberOfCigs_dealer -= 1
|
||||||
|
"beer":
|
||||||
|
hand_beer.visible = true
|
||||||
|
itemManager.itemArray_instances_dealer.remove_at(matchIndex)
|
||||||
|
var tempindicator = activeInstance.get_child(0)
|
||||||
|
var gridname = tempindicator.dealerGridName
|
||||||
|
itemManager.gridParentArray_enemy_available.append(gridname)
|
||||||
|
activeInstance.queue_free()
|
||||||
|
await get_tree().create_timer(.2, false).timeout
|
||||||
|
ReturnHand()
|
||||||
|
if (whichGridSide == "right"): animator_dealerHeadLook.play("dealer look forward from right")
|
||||||
|
else: animator_dealerHeadLook.play("dealer look forward from left")
|
||||||
|
await get_tree().create_timer(lerpDuration + .01, false).timeout
|
||||||
|
HandFailsafe()
|
||||||
|
var animationName = "dealer use " + itemName
|
||||||
|
animator_hands.play("RESET")
|
||||||
|
animator_hands.play(animationName)
|
||||||
|
var length = animator_hands.get_animation(animationName).get_length()
|
||||||
|
moving = false
|
||||||
|
await get_tree().create_timer(length, false).timeout
|
||||||
|
pass
|
||||||
|
|
||||||
|
func ToggleHandVisible(selectedHand : String, state : bool):
|
||||||
|
if (selectedHand == "L" or "BOTH"):
|
||||||
|
for i in range(handArray_L.size()):
|
||||||
|
if (state): handArray_L[i].visible = true
|
||||||
|
else: handArray_L[i].visible = false
|
||||||
|
if (selectedHand == "R" or "BOTH"):
|
||||||
|
for i in range(handArray_R.size()):
|
||||||
|
if (state): handArray_R[i].visible = true
|
||||||
|
else: handArray_R[i].visible = false
|
||||||
|
|
||||||
|
func BeginHandLerp(whichHand : String, gridIndex : int, whichSide : String):
|
||||||
|
if (whichHand == "right"): activeHandParent = handParent_R
|
||||||
|
else: activeHandParent = handParent_L
|
||||||
|
pos_current = activeHandParent.transform.origin
|
||||||
|
rot_current = activeHandParent.rotation_degrees
|
||||||
|
orig_pos = pos_current
|
||||||
|
orig_rot = rot_current
|
||||||
|
pos_next = gridOffsetArray[gridIndex]
|
||||||
|
lerping_L = false
|
||||||
|
lerping_R = false
|
||||||
|
if(whichSide == "right"): rot_next = handRot_right
|
||||||
|
else: rot_next = handRot_left
|
||||||
|
if(whichHand == "right"): lerping_R = true
|
||||||
|
else: lerping_L = true
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func ReturnHand():
|
||||||
|
pos_current = activeHandParent.transform.origin
|
||||||
|
rot_current = activeHandParent.rotation_degrees
|
||||||
|
pos_next = orig_pos
|
||||||
|
rot_next = orig_rot
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func HandFailsafe():
|
||||||
|
handParent_L.transform.origin = parentOriginal_posL
|
||||||
|
handParent_L.rotation_degrees = parentOriginal_rotL
|
||||||
|
handParent_R.transform.origin = parentOriginal_posR
|
||||||
|
handParent_R.rotation_degrees = parentOriginal_rotR
|
||||||
|
|
||||||
|
func LerpHandMovement():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / lerpDuration, 0.0, 1.0)
|
||||||
|
c = ease(c, 0.2)
|
||||||
|
if (lerping_L):
|
||||||
|
var pos = lerp(pos_current, pos_next, c)
|
||||||
|
var rot = lerp(rot_current, rot_next, c)
|
||||||
|
handParent_L.transform.origin = pos
|
||||||
|
handParent_L.rotation_degrees = rot
|
||||||
|
if (lerping_R):
|
||||||
|
var pos = lerp(pos_current, pos_next, c)
|
||||||
|
var rot = lerp(rot_current, rot_next, c)
|
||||||
|
handParent_R.transform.origin = pos
|
||||||
|
handParent_R.rotation_degrees = rot
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
56
HandcuffManager.gd
Normal file
56
HandcuffManager.gd
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
class_name HandcuffManager extends Node
|
||||||
|
|
||||||
|
@export var dealerAI : DealerIntelligence
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var animator_handcuffsPlayer : AnimationPlayer
|
||||||
|
@export var handcuffs_player : Node3D
|
||||||
|
|
||||||
|
var previousSocket
|
||||||
|
|
||||||
|
func AttachHandCuffs():
|
||||||
|
animator_handcuffsPlayer.play("RESET")
|
||||||
|
await get_tree().create_timer(.1, false).timeout
|
||||||
|
handcuffs_player.visible = true
|
||||||
|
|
||||||
|
func CheckPlayerHandCuffs(lerpingToPrevious : bool):
|
||||||
|
previousSocket = camera.activeSocket
|
||||||
|
camera.BeginLerp("check handcuffs")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
animator_handcuffsPlayer.play("check handcuffs")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
if (lerpingToPrevious): camera.BeginLerp(previousSocket)
|
||||||
|
|
||||||
|
func BreakPlayerHandCuffs(lerpingToPrevious : bool):
|
||||||
|
previousSocket = camera.activeSocket
|
||||||
|
camera.BeginLerp("check handcuffs")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
animator_handcuffsPlayer.play("player break handcuffs")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
if (lerpingToPrevious): camera.BeginLerp(previousSocket)
|
||||||
|
|
||||||
|
func CheckPlayerHandCuffs_Animation():
|
||||||
|
previousSocket = camera.activeSocket
|
||||||
|
camera.BeginLerp("check handcuffs")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
animator_handcuffsPlayer.play("check handcuffs")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
camera.BeginLerp(previousSocket)
|
||||||
|
|
||||||
|
func RemoveAllCuffsRoutine():
|
||||||
|
if (roundManager.dealerCuffed):
|
||||||
|
camera.BeginLerp("enemy cuffs close")
|
||||||
|
await get_tree().create_timer(.3, false).timeout
|
||||||
|
dealerAI.animator_dealerHands.play("dealer break cuffs")
|
||||||
|
dealerAI.speaker_breakHandcuffs.play()
|
||||||
|
dealerAI.dealerAboutToBreakFree = false
|
||||||
|
roundManager.dealerCuffed = false
|
||||||
|
await get_tree().create_timer(.47, false).timeout
|
||||||
|
if (roundManager.playerCuffed):
|
||||||
|
camera.BeginLerp("check handcuffs")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
animator_handcuffsPlayer.play("player break handcuffs")
|
||||||
|
roundManager.playerCuffed = false
|
||||||
|
roundManager.playerAboutToBreakFree = false
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
pass
|
195
HealthCounter.gd
Normal file
195
HealthCounter.gd
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
class_name HealthCounter extends Node
|
||||||
|
|
||||||
|
@export var ui_playerwin : Label3D
|
||||||
|
@export var defibCutter : DefibCutter
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var symbolArray_player : Array[MeshInstance3D]
|
||||||
|
@export var symbolArray_enemy : Array[MeshInstance3D]
|
||||||
|
@export var uiparent : Node3D
|
||||||
|
@export var ui_playername : Label3D
|
||||||
|
@export var uiArray : Array[Node3D]
|
||||||
|
@export var speaker_bootup : AudioStreamPlayer3D
|
||||||
|
@export var speaker_beep : AudioStreamPlayer3D
|
||||||
|
@export var speaker_noise : AudioStreamPlayer3D
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var animator_flickerEnemy : AnimationPlayer
|
||||||
|
@export var animator_flickerPlayer : AnimationPlayer
|
||||||
|
@export var animator_playerHands : AnimationPlayer
|
||||||
|
@export var animator_dealerHands : AnimationPlayer
|
||||||
|
@export var dialogue : Dialogue
|
||||||
|
@export var speaker_truedeath : AudioStreamPlayer2D
|
||||||
|
@export var skullSymbols : Array[VisualInstance3D]
|
||||||
|
|
||||||
|
var dialogueEntered_player = false
|
||||||
|
var dialogueEntered_dealer = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
ClearDisplay()
|
||||||
|
pass
|
||||||
|
|
||||||
|
var setting = true
|
||||||
|
func SetupHealth():
|
||||||
|
if (roundManager.roundArray[roundManager.currentRound].isFirstRound):
|
||||||
|
if (setting):
|
||||||
|
ui_playername.text = roundManager.playerData.playername.to_upper()
|
||||||
|
ui_playerwin.text = roundManager.playerData.playername.to_upper() + " WINS!"
|
||||||
|
setting = false
|
||||||
|
roundManager.health_player = roundManager.roundArray[roundManager.currentRound].startingHealth
|
||||||
|
roundManager.health_opponent = roundManager.roundArray[roundManager.currentRound].startingHealth
|
||||||
|
dialogueEntered_player = false
|
||||||
|
dialogueEntered_dealer = false
|
||||||
|
|
||||||
|
func UpdateDisplay():
|
||||||
|
for i in range(symbolArray_player.size()):
|
||||||
|
if (i <= roundManager.health_player):
|
||||||
|
symbolArray_player[i].visible = true
|
||||||
|
else: symbolArray_player[i].visible = false
|
||||||
|
for i in range(symbolArray_enemy.size()):
|
||||||
|
if (i <= roundManager.health_opponent):
|
||||||
|
symbolArray_enemy[i].visible = true
|
||||||
|
else: symbolArray_enemy[i].visible = false
|
||||||
|
FlickerLastDigit()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func FlickerLastDigit():
|
||||||
|
if (roundManager.health_player == 1): animator_flickerPlayer.play("flicker digit")
|
||||||
|
else: animator_flickerPlayer.play("RESET")
|
||||||
|
if (roundManager.health_opponent == 1): animator_flickerEnemy.play("flicker digit")
|
||||||
|
else: animator_flickerEnemy.play("RESET")
|
||||||
|
|
||||||
|
var playerShotSelf = false
|
||||||
|
var trueDeathSetup = false
|
||||||
|
var checkingPlayer = false
|
||||||
|
func UpdateDisplayRoutine(isRaisingHealth : bool, goingToPreviousSocket : bool, showPlayerWin : bool):
|
||||||
|
var indicating = true
|
||||||
|
if (roundManager.dealerCuffed && playerShotSelf):
|
||||||
|
roundManager.waitingForHealthCheck = true
|
||||||
|
playerShotSelf = false
|
||||||
|
if (showPlayerWin):
|
||||||
|
#ERROR - FLICKER BOTH HERE
|
||||||
|
camera.BeginLerp("health counter")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
UpdateDisplay()
|
||||||
|
speaker_noise.play()
|
||||||
|
return
|
||||||
|
var previousSocket = camera.activeSocket
|
||||||
|
camera.BeginLerp("health counter")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
UpdateDisplay()
|
||||||
|
if (checkingPlayer && defibCutter.displayBroken_player):
|
||||||
|
indicating = false
|
||||||
|
defibCutter.BlipError("player")
|
||||||
|
if (!checkingPlayer && defibCutter.displayBroken_dealer):
|
||||||
|
indicating = false
|
||||||
|
defibCutter.BlipError("dealer")
|
||||||
|
if (indicating):
|
||||||
|
if (isRaisingHealth): speaker_beep.play()
|
||||||
|
else: speaker_noise.play()
|
||||||
|
if ((roundManager.health_opponent <= 2 or roundManager.health_player <= 2) && roundManager.playerData.currentBatchIndex == 2):
|
||||||
|
if (roundManager.defibCutterReady && !trueDeathSetup):
|
||||||
|
#roundManager.musicManager.EndTrack()
|
||||||
|
speaker_truedeath.play()
|
||||||
|
trueDeathSetup = true
|
||||||
|
if (roundManager.health_opponent <= 2 && !roundManager.wireIsCut_dealer):
|
||||||
|
roundManager.wireToCut = "dealer"
|
||||||
|
roundManager.requestedWireCut = true
|
||||||
|
roundManager.wireIsCut_dealer = true
|
||||||
|
roundManager.health_opponent = 1
|
||||||
|
if (roundManager.health_player <= 2 && !roundManager.wireIsCut_player):
|
||||||
|
roundManager.wireToCut = "player"
|
||||||
|
roundManager.requestedWireCut = true
|
||||||
|
roundManager.wireIsCut_player = true
|
||||||
|
roundManager.health_player = 1
|
||||||
|
#if (roundManager.shellSpawner.sequenceArray[0] == null): await get_tree().create_timer(.8, false).timeout
|
||||||
|
await get_tree().create_timer(.7, false).timeout
|
||||||
|
if (roundManager.health_player == 1 && !dialogueEntered_player && !roundManager.wireIsCut_player):
|
||||||
|
if (!roundManager.wireIsCut_player): dialogue.ShowText_ForDuration("CAREFUL, NOW ...", 3)
|
||||||
|
else: dialogue.ShowText_ForDuration("OH MY ...", 3)
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
dialogueEntered_player = true
|
||||||
|
var lerpingCamera = true
|
||||||
|
if (roundManager.shellSpawner.sequenceArray.size() == 0):
|
||||||
|
#lerpingCamera = false
|
||||||
|
pass
|
||||||
|
if (lerpingCamera):
|
||||||
|
if (goingToPreviousSocket): camera.BeginLerp(previousSocket)
|
||||||
|
else: camera.BeginLerp("home")
|
||||||
|
await get_tree().create_timer(.4, false).timeout
|
||||||
|
|
||||||
|
#why can I not add functions with arguments into godot animator :sob:
|
||||||
|
func UpdateDisplayRoutineCigarette_Enemy():
|
||||||
|
var maxHealth = roundManager.roundArray[0].startingHealth
|
||||||
|
var changingHealth = false
|
||||||
|
var prevhealth = roundManager.health_opponent
|
||||||
|
if (!roundManager.wireIsCut_dealer): roundManager.health_opponent += 1
|
||||||
|
if (roundManager.health_opponent > maxHealth): roundManager.health_opponent = maxHealth
|
||||||
|
var newhealth = roundManager.health_opponent
|
||||||
|
if (newhealth != prevhealth): changingHealth = true
|
||||||
|
UpdateDisplayRoutineCigarette_Main(changingHealth, true)
|
||||||
|
pass
|
||||||
|
|
||||||
|
func UpdateDisplayRoutineCigarette_Player():
|
||||||
|
var maxHealth = roundManager.roundArray[0].startingHealth
|
||||||
|
var changingHealth = false
|
||||||
|
var prevhealth = roundManager.health_player
|
||||||
|
if (!roundManager.wireIsCut_player): roundManager.health_player += 1
|
||||||
|
if (roundManager.health_player > maxHealth): roundManager.health_player = maxHealth
|
||||||
|
var newhealth = roundManager.health_player
|
||||||
|
if (newhealth != prevhealth): changingHealth = true
|
||||||
|
UpdateDisplayRoutineCigarette_Main(changingHealth, false)
|
||||||
|
pass
|
||||||
|
|
||||||
|
func UpdateDisplayRoutineCigarette_Main(isChanging : bool, isAddingEnemy : bool):
|
||||||
|
var prevsocket = camera.activeSocket
|
||||||
|
var playingsound = true
|
||||||
|
camera.BeginLerp("health counter")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
if (isAddingEnemy && defibCutter.displayBroken_dealer):
|
||||||
|
defibCutter.BlipError("dealer")
|
||||||
|
playingsound = false
|
||||||
|
if (!isAddingEnemy && defibCutter.displayBroken_player):
|
||||||
|
defibCutter.BlipError("player")
|
||||||
|
playingsound = false
|
||||||
|
UpdateDisplay()
|
||||||
|
if (isChanging && playingsound): speaker_beep.play()
|
||||||
|
await get_tree().create_timer(.7, false).timeout
|
||||||
|
if (!isAddingEnemy):
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
animator_playerHands.play("player revert cigarette")
|
||||||
|
else:
|
||||||
|
camera.BeginLerp("enemy")
|
||||||
|
animator_dealerHands.play("RESET")
|
||||||
|
pass
|
||||||
|
|
||||||
|
func SwapSkullSymbols():
|
||||||
|
for sym in skullSymbols:
|
||||||
|
sym.set_layer_mask_value(1, true)
|
||||||
|
sym.get_parent().set_layer_mask_value(1, false)
|
||||||
|
|
||||||
|
#orig .13
|
||||||
|
var settingUpBroken = false
|
||||||
|
func Bootup():
|
||||||
|
speaker_bootup.play()
|
||||||
|
#uiparent.visible = true
|
||||||
|
ClearDisplay()
|
||||||
|
for i in range(uiArray.size()):
|
||||||
|
uiArray[i].visible = true
|
||||||
|
await get_tree().create_timer(.85, false).timeout
|
||||||
|
if (roundManager.playerData.currentBatchIndex == 2 && !settingUpBroken):
|
||||||
|
speaker_beep.pitch_scale = .09
|
||||||
|
SwapSkullSymbols()
|
||||||
|
settingUpBroken = true
|
||||||
|
speaker_beep.play()
|
||||||
|
UpdateDisplay()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func ClearDisplay():
|
||||||
|
for i in range(symbolArray_player.size()):
|
||||||
|
symbolArray_player[i].visible = false
|
||||||
|
for i in range(symbolArray_enemy.size()):
|
||||||
|
symbolArray_enemy[i].visible = false
|
||||||
|
|
||||||
|
func DisableCounter():
|
||||||
|
for i in range(uiArray.size()):
|
||||||
|
uiArray[i].visible = false
|
||||||
|
#uiparent.visible = false
|
60
HeavenManager.gd
Normal file
60
HeavenManager.gd
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
class_name Heaven extends Node
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
Signals()
|
||||||
|
BeginLoop()
|
||||||
|
|
||||||
|
func Signals():
|
||||||
|
buttonArray[0].is_pressed.connect(Button_Retry)
|
||||||
|
buttonArray[1].is_pressed.connect(Button_Exit)
|
||||||
|
pass
|
||||||
|
|
||||||
|
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")
|
||||||
|
for cl in buttonArray:
|
||||||
|
cl.isActive = false
|
||||||
|
await get_tree().create_timer(3.12, false).timeout
|
||||||
|
match tag:
|
||||||
|
"retry":
|
||||||
|
get_tree().change_scene_to_file("res://scenes/death.tscn")
|
||||||
|
"exit":
|
||||||
|
get_tree().quit()
|
||||||
|
|
||||||
|
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
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
intbranch_heavendoor.interactionAllowed = true
|
||||||
|
|
||||||
|
func Fly():
|
||||||
|
intbranch_heavendoor.interactionAllowed = false
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
animator.play("move")
|
||||||
|
await get_tree().create_timer(15.6, false).timeout
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
interactionManager.checking = false
|
||||||
|
for cl in buttonArray:
|
||||||
|
cl.isActive = true
|
||||||
|
pass
|
18
InteractionBranch.gd
Normal file
18
InteractionBranch.gd
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
class_name InteractionBranch extends Node
|
||||||
|
|
||||||
|
@export var interactionAlias : String
|
||||||
|
@export var itemName : String
|
||||||
|
@export var interactionAllowed : bool
|
||||||
|
@export var isGrid : bool
|
||||||
|
@export var gridIndex : int
|
||||||
|
@export var itemGridIndex : int
|
||||||
|
@export var interactionInvalid : bool
|
||||||
|
@export var signatureButton_letterAlias : String
|
||||||
|
@export var signatureButton_specialAlias : String
|
||||||
|
@export var assignedSignatureButton : SignButton
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
if (signatureButton_letterAlias != ""):
|
||||||
|
assignedSignatureButton = get_parent().get_child(3)
|
||||||
|
if (signatureButton_specialAlias != ""):
|
||||||
|
assignedSignatureButton = get_parent().get_child(3)
|
104
InteractionManager.gd
Normal file
104
InteractionManager.gd
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
class_name InteractionManager extends Node
|
||||||
|
|
||||||
|
@export var sign : Signature
|
||||||
|
@export var brief : BriefcaseMachine
|
||||||
|
@export var heaven : Heaven
|
||||||
|
@export var intro : IntroManager
|
||||||
|
@export var cursor : CursorManager
|
||||||
|
@export var mouseRay : MouseRaycast
|
||||||
|
@export var shotgun : ShotgunShooting
|
||||||
|
@export var decision : DecisionTextManager
|
||||||
|
@export var itemManager : ItemManager
|
||||||
|
@export var itemInteraction : ItemInteraction
|
||||||
|
var activeParent
|
||||||
|
var activeInteractionBranch
|
||||||
|
var checking = true
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
CheckPickupLerp()
|
||||||
|
CheckInteractionBranch()
|
||||||
|
if (checking): CheckIfHovering()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||||
|
if (activeInteractionBranch != null && activeInteractionBranch.interactionAllowed && !activeInteractionBranch.interactionInvalid):
|
||||||
|
var childArray = activeInteractionBranch.get_parent().get_children()
|
||||||
|
for i in range(childArray.size()): if (childArray[i] is PickupIndicator): childArray[i].SnapToMax()
|
||||||
|
if (!activeInteractionBranch.isGrid): InteractWith(activeInteractionBranch.interactionAlias)
|
||||||
|
else: InteractWithGrid(activeInteractionBranch.gridIndex)
|
||||||
|
|
||||||
|
func CheckIfHovering():
|
||||||
|
if (activeInteractionBranch != null && activeInteractionBranch.interactionAllowed):
|
||||||
|
if (activeInteractionBranch.interactionAllowed && !activeInteractionBranch.interactionInvalid):
|
||||||
|
cursor.SetCursorImage("hover")
|
||||||
|
else: if (activeInteractionBranch.interactionAllowed && activeInteractionBranch.interactionInvalid):
|
||||||
|
cursor.SetCursorImage("invalid")
|
||||||
|
else:
|
||||||
|
cursor.SetCursorImage("point")
|
||||||
|
|
||||||
|
func InteractWith(alias : String):
|
||||||
|
match(alias):
|
||||||
|
"shotgun":
|
||||||
|
shotgun.GrabShotgun()
|
||||||
|
pass
|
||||||
|
"text dealer":
|
||||||
|
shotgun.Shoot("dealer")
|
||||||
|
decision.SetUI(false)
|
||||||
|
"text you":
|
||||||
|
shotgun.Shoot("self")
|
||||||
|
decision.SetUI(false)
|
||||||
|
"briefcase intake":
|
||||||
|
itemManager.GrabItem()
|
||||||
|
"item":
|
||||||
|
if (activeInteractionBranch.itemName != ""):
|
||||||
|
itemInteraction.PickupItemFromTable(activeInteractionBranch.get_parent(), activeInteractionBranch.itemName)
|
||||||
|
"bathroom door":
|
||||||
|
intro.Interaction_BathroomDoor()
|
||||||
|
"backroom door":
|
||||||
|
intro.Interaction_BackroomDoor()
|
||||||
|
"heaven door":
|
||||||
|
heaven.Fly()
|
||||||
|
"latch left":
|
||||||
|
brief.OpenLatch("L")
|
||||||
|
"latch right":
|
||||||
|
brief.OpenLatch("R")
|
||||||
|
"briefcase lid":
|
||||||
|
brief.OpenLid()
|
||||||
|
"release form on table":
|
||||||
|
sign.PickUpWaiver()
|
||||||
|
"signature machine button":
|
||||||
|
sign.GetInput(activeInteractionBranch.signatureButton_letterAlias, activeInteractionBranch.signatureButton_specialAlias)
|
||||||
|
activeInteractionBranch.assignedSignatureButton.Press()
|
||||||
|
|
||||||
|
func InteractWithGrid(tempGridIndex : int):
|
||||||
|
itemManager.PlaceDownItem(tempGridIndex)
|
||||||
|
pass
|
||||||
|
|
||||||
|
func CheckPickupLerp():
|
||||||
|
if (mouseRay.result != null && mouseRay.result.has("collider") && cursor.cursor_visible):
|
||||||
|
var parent = mouseRay.result.collider.get_parent()
|
||||||
|
activeParent = parent
|
||||||
|
var childArray = parent.get_children()
|
||||||
|
for i in range(childArray.size()):
|
||||||
|
if (childArray[i] is PickupIndicator):
|
||||||
|
var indicator = childArray[i]
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
activeParent = null
|
||||||
|
pass
|
||||||
|
|
||||||
|
func CheckInteractionBranch():
|
||||||
|
var isFound = null
|
||||||
|
if (activeParent != null):
|
||||||
|
var childArray = activeParent.get_children()
|
||||||
|
for i in range(childArray.size()):
|
||||||
|
if (childArray[i] is InteractionBranch):
|
||||||
|
var branch = childArray[i]
|
||||||
|
# activeInteractionBranch = childArray[i]
|
||||||
|
isFound = childArray[i]
|
||||||
|
break
|
||||||
|
if (isFound):
|
||||||
|
activeInteractionBranch = isFound
|
||||||
|
else:
|
||||||
|
activeInteractionBranch = null
|
127
IntroManager.gd
Normal file
127
IntroManager.gd
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
class_name IntroManager extends Node
|
||||||
|
|
||||||
|
@export var cameraParent : Node3D
|
||||||
|
@export var intbranch_bathroomdoor : InteractionBranch
|
||||||
|
@export var intbranch_backroomdoor: InteractionBranch
|
||||||
|
@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
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
if (roundManager.playerData.playerEnteringFromDeath && !roundManager.playerData.enteringFromTrueDeath):
|
||||||
|
RevivalBathroomStart()
|
||||||
|
else:
|
||||||
|
MainBathroomStart()
|
||||||
|
pass
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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("YOU'RE LUCKY IT LEFT YOU\nWITH A CHARGE!")
|
||||||
|
var n = roundManager.playerData.playername
|
||||||
|
var firstpart = "GET UP, " + n + "."
|
||||||
|
var secondpart = "\nTHE NIGHT IS YOUNG."
|
||||||
|
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)
|
||||||
|
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_BackroomDoor():
|
||||||
|
roundManager.playerData.stat_doorsKicked += 1
|
||||||
|
animator_camera.play("camera enter backroom")
|
||||||
|
intbranch_backroomdoor.interactionAllowed = false
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
|
||||||
|
func Interaction_BathroomDoor():
|
||||||
|
intbranch_bathroomdoor.interactionAllowed = false
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
animator_camera.play("camera exit bathroom")
|
||||||
|
await get_tree().create_timer(5, false).timeout
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
intbranch_backroomdoor.interactionAllowed = 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()
|
||||||
|
|
||||||
|
func RestRoomIdle():
|
||||||
|
animator_camera.play("camera idle bathroom")
|
||||||
|
pass
|
12
ItemGridIndicator.gd
Normal file
12
ItemGridIndicator.gd
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class_name GridIndicator extends Node
|
||||||
|
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var animator : AnimationPlayer
|
||||||
|
@export var parent: Node3D
|
||||||
|
|
||||||
|
func ShowGridIndicator():
|
||||||
|
parent.visible = true
|
||||||
|
animator.play("show")
|
||||||
|
roundManager.playerData.indicatorShown = true
|
||||||
|
await get_tree().create_timer(1, false).timeout
|
||||||
|
parent.visible = false
|
135
ItemInteraction.gd
Normal file
135
ItemInteraction.gd
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
class_name ItemInteraction extends Node
|
||||||
|
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var dealerIntelligence : DealerIntelligence
|
||||||
|
@export var cursor : CursorManager
|
||||||
|
@export var perm : PermissionManager
|
||||||
|
@export var itemManager : ItemManager
|
||||||
|
@export var lerpDuration : float
|
||||||
|
@export var pos_hand : Vector3
|
||||||
|
@export var rot_hand : Vector3
|
||||||
|
@export var animator_dealerHands : AnimationPlayer
|
||||||
|
@export var animator_playerHands : AnimationPlayer
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var shellEject_player : ShellEjectManager
|
||||||
|
@export var speaker_pickup : AudioStreamPlayer2D
|
||||||
|
@export var speaker_breakcuffs : AudioStreamPlayer2D
|
||||||
|
|
||||||
|
var temp_itemParent
|
||||||
|
var pos_current
|
||||||
|
var pos_next
|
||||||
|
var rot_current
|
||||||
|
var rot_next
|
||||||
|
var temp_interaction
|
||||||
|
var temp_indicator
|
||||||
|
var elapsed = 0
|
||||||
|
var moving = false
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
LerpMovement()
|
||||||
|
|
||||||
|
func PickupItemFromTable(itemParent : Node3D, passedItemName : String):
|
||||||
|
#SET INTERACTION PERMISSIONS, HIDE CURSOR
|
||||||
|
perm.SetIndicators(false)
|
||||||
|
perm.SetInteractionPermissions(false)
|
||||||
|
perm.RevertDescriptionUI()
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
#GET VARIABLES
|
||||||
|
temp_itemParent = itemParent
|
||||||
|
temp_indicator = itemParent.get_child(0)
|
||||||
|
temp_interaction = itemParent.get_child(1)
|
||||||
|
#PLAY PICKUP SOUND
|
||||||
|
speaker_pickup.stream = temp_indicator.sound_pickup
|
||||||
|
speaker_pickup.pitch_scale = randf_range(.93, 1.0)
|
||||||
|
speaker_pickup.play()
|
||||||
|
#INTERACTION PERMISSIONS
|
||||||
|
#perm.SetIndicators(false)
|
||||||
|
#cursor.SetCursor(false, false)
|
||||||
|
#perm.SetInteractionPermissions(false)
|
||||||
|
temp_indicator.lerpEnabled = false
|
||||||
|
temp_indicator.interactionAllowed = false
|
||||||
|
temp_indicator.SnapToMax()
|
||||||
|
temp_interaction.interactionAllowed = false
|
||||||
|
#LERP
|
||||||
|
pos_current = temp_itemParent.transform.origin
|
||||||
|
rot_current = temp_itemParent.rotation_degrees
|
||||||
|
pos_next = pos_hand
|
||||||
|
rot_next = rot_hand
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
await get_tree().create_timer(lerpDuration -.1, false).timeout
|
||||||
|
moving = false
|
||||||
|
RemovePlayerItemFromGrid(temp_itemParent)
|
||||||
|
temp_itemParent.queue_free() #check where player grid index is given, and remove item from player item array, unoccupy given grid
|
||||||
|
InteractWith(passedItemName)
|
||||||
|
|
||||||
|
func InteractWith(itemName : String):
|
||||||
|
#INTERACTION
|
||||||
|
match (itemName):
|
||||||
|
"handcuffs":
|
||||||
|
animator_dealerHands.play("dealer get handcuffed")
|
||||||
|
await get_tree().create_timer(1, false).timeout
|
||||||
|
camera.BeginLerp("enemy")
|
||||||
|
await get_tree().create_timer(1.3, false).timeout
|
||||||
|
camera.BeginLerp("dealer handcuffs")
|
||||||
|
roundManager.dealerCuffed = true
|
||||||
|
dealerIntelligence.dealerAboutToBreakFree = false
|
||||||
|
await get_tree().create_timer(1.3, false).timeout
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
EnablePermissions()
|
||||||
|
"beer":
|
||||||
|
roundManager.playerData.stat_beerDrank += 330
|
||||||
|
var isFinalShell = false
|
||||||
|
if (roundManager.shellSpawner.sequenceArray.size() == 1): isFinalShell = true
|
||||||
|
animator_playerHands.play("player use beer")
|
||||||
|
await get_tree().create_timer(1.4, false).timeout
|
||||||
|
shellEject_player.FadeOutShell()
|
||||||
|
await get_tree().create_timer(4.2, false).timeout
|
||||||
|
#check if ejected last shell
|
||||||
|
if (!isFinalShell): EnablePermissions()
|
||||||
|
else:
|
||||||
|
roundManager.StartRound(true)
|
||||||
|
"magnifying glass":
|
||||||
|
animator_playerHands.play("player use magnifier")
|
||||||
|
var length = animator_playerHands.get_animation("player use magnifier").get_length()
|
||||||
|
await get_tree().create_timer(length + .2, false).timeout
|
||||||
|
EnablePermissions()
|
||||||
|
"cigarettes":
|
||||||
|
roundManager.playerData.stat_cigSmoked += 1
|
||||||
|
animator_playerHands.play("player use cigarettes")
|
||||||
|
await get_tree().create_timer(5, false).timeout
|
||||||
|
itemManager.numberOfCigs_player -= 1
|
||||||
|
EnablePermissions()
|
||||||
|
"handsaw":
|
||||||
|
animator_playerHands.play("player use handsaw")
|
||||||
|
roundManager.barrelSawedOff = true
|
||||||
|
roundManager.currentShotgunDamage = 2
|
||||||
|
await get_tree().create_timer(4.28 + .2, false).timeout
|
||||||
|
EnablePermissions()
|
||||||
|
|
||||||
|
func EnablePermissions():
|
||||||
|
perm.SetStackInvalidIndicators()
|
||||||
|
perm.SetIndicators(true)
|
||||||
|
perm.SetInteractionPermissions(true)
|
||||||
|
perm.RevertDescriptionUI()
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
|
||||||
|
func PlaySound_BreakHandcuffs():
|
||||||
|
speaker_breakcuffs.play()
|
||||||
|
|
||||||
|
func RemovePlayerItemFromGrid(parent : Node3D):
|
||||||
|
var indic = parent.get_child(0)
|
||||||
|
var inter = parent.get_child(1)
|
||||||
|
itemManager.items_dynamicIndicatorArray.erase(indic)
|
||||||
|
itemManager.items_dynamicInteractionArray.erase(inter)
|
||||||
|
itemManager.gridOccupiedArray[inter.itemGridIndex] = false
|
||||||
|
itemManager.numberOfOccupiedGrids -= 1
|
||||||
|
|
||||||
|
func LerpMovement():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / lerpDuration, 0.0, 1.0)
|
||||||
|
#c = ease(c, 0.1)
|
||||||
|
temp_itemParent.transform.origin = lerp(pos_current, pos_next, c)
|
||||||
|
temp_itemParent.rotation_degrees = lerp(rot_current, rot_next, c)
|
443
ItemManager.gd
Normal file
443
ItemManager.gd
Normal file
@ -0,0 +1,443 @@
|
|||||||
|
class_name ItemManager extends Node
|
||||||
|
|
||||||
|
@export var grid : GridIndicator
|
||||||
|
@export var cursor : CursorManager
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var dialogue : Dialogue
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var comp : CompartmentManager
|
||||||
|
@export var interaction_intake : InteractionBranch
|
||||||
|
@export var instanceArray : Array[ItemResource]
|
||||||
|
@export var instanceArray_dealer : Array[ItemResource]
|
||||||
|
@export var availableItemArray : Array[String]
|
||||||
|
@export var itemSpawnParent : Node3D
|
||||||
|
@export var lerpDuration : float
|
||||||
|
@export var gridParentArray : Array[Node3D]
|
||||||
|
@export var gridParentArray_enemy : Array[Node3D]
|
||||||
|
var gridParentArray_enemy_available : Array[Node3D]
|
||||||
|
@export var gridOccupiedArray : Array[bool]
|
||||||
|
@export var stringNumberArray : Array[String]
|
||||||
|
@export var gridParent_1 : Node3D
|
||||||
|
@export var gridParent_2 : Node3D
|
||||||
|
@export var gridParent_3 : Node3D
|
||||||
|
@export var gridParent_4 : Node3D
|
||||||
|
@export var soundArray_itemGrab : Array[AudioStream]
|
||||||
|
@export var speaker_itemgrab : AudioStreamPlayer2D
|
||||||
|
@export var speaker_placedown : AudioStreamPlayer2D
|
||||||
|
@export var anim_spook : AnimationPlayer
|
||||||
|
@export var speakercontroller_musicmain : SpeakerController
|
||||||
|
@export var speaker_god : AudioStreamPlayer2D
|
||||||
|
var itemGrabSoundIndex = 0
|
||||||
|
var itemArray_dealer : Array[String]
|
||||||
|
var itemArray_instances_dealer : Array[Node3D]
|
||||||
|
var itemArray_player : Array[String]
|
||||||
|
var hasBegun = false
|
||||||
|
var items_dynamicIndicatorArray : Array[PickupIndicator]
|
||||||
|
var items_dynamicInteractionArray : Array[InteractionBranch]
|
||||||
|
|
||||||
|
var numberOfCigs_player = 0
|
||||||
|
var numberOfCigs_dealer = 0
|
||||||
|
var playerItemStringArray
|
||||||
|
var availableItemsToGrabArray_player
|
||||||
|
var availableItemsToGrabArray_dealer
|
||||||
|
var numberOfItemsGrabbed_enemy = 0
|
||||||
|
var numberOfItemsGrabbed = 0
|
||||||
|
var numberOfOccupiedGrids = 0
|
||||||
|
var activeItem_offset_pos
|
||||||
|
var activeItem_offset_rot
|
||||||
|
var activeItem
|
||||||
|
var activeItem_enemy
|
||||||
|
var elapsed = 0
|
||||||
|
var moving = false
|
||||||
|
var pos_current
|
||||||
|
var pos_next
|
||||||
|
var rot_current
|
||||||
|
var rot_next
|
||||||
|
var temp_indicator
|
||||||
|
var temp_interaction
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
playerItemStringArray = []
|
||||||
|
availableItemsToGrabArray_player = availableItemArray
|
||||||
|
availableItemsToGrabArray_dealer = availableItemArray
|
||||||
|
ResetDealerGrid()
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
LerpItem()
|
||||||
|
|
||||||
|
func ItemClear_Remote():
|
||||||
|
var itemParentChildrenArray = itemSpawnParent.get_children()
|
||||||
|
for i in range(itemParentChildrenArray.size()):
|
||||||
|
if (itemParentChildrenArray[i].get_child(0) is PickupIndicator):
|
||||||
|
requestingItemClear = true
|
||||||
|
break
|
||||||
|
if (requestingItemClear):
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
SetupItemClear()
|
||||||
|
comp.animator_compartment.play("clear items")
|
||||||
|
await get_tree().create_timer(1.6).timeout
|
||||||
|
comp.animator_compartment.play("hide items")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
else:
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
comp.animator_compartment.play("hide items")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
|
||||||
|
var newBatchHasBegun = false
|
||||||
|
var requestingItemClear = false
|
||||||
|
func BeginItemGrabbing():
|
||||||
|
roundManager.ignoring = false
|
||||||
|
numberOfItemsGrabbed = 0
|
||||||
|
if (roundManager.playerData.hasReadItemSwapIntroduction): camera.BeginLerp("home")
|
||||||
|
else: camera.BeginLerp("enemy")
|
||||||
|
var itemParentChildrenArray = itemSpawnParent.get_children()
|
||||||
|
#CLEAR ITEMS FROM TABLE
|
||||||
|
if (newBatchHasBegun):
|
||||||
|
for i in range(itemParentChildrenArray.size()):
|
||||||
|
if (itemParentChildrenArray[i].get_child(0) is PickupIndicator):
|
||||||
|
requestingItemClear = true
|
||||||
|
break
|
||||||
|
if (requestingItemClear):
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
SetupItemClear()
|
||||||
|
comp.animator_compartment.play("clear items")
|
||||||
|
await get_tree().create_timer(1.4).timeout
|
||||||
|
newBatchHasBegun = false
|
||||||
|
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
if (!roundManager.playerData.hasReadItemSwapIntroduction):
|
||||||
|
dialogue.ShowText_ForDuration("LET'S MAKE THIS A LITTLE\nMORE INTERESTING ...", 3)
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
roundManager.playerData.hasReadItemSwapIntroduction = true
|
||||||
|
comp.CycleCompartment("show briefcase")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
if (comp.isHiding_items): comp.CycleCompartment("show items")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
camera.BeginLerp("briefcase")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
|
||||||
|
if (!roundManager.playerData.hasReadItemDistributionIntro):
|
||||||
|
var stringIndex = roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab
|
||||||
|
var string = stringNumberArray[stringIndex]
|
||||||
|
dialogue.ShowText_Forever(string+" ITEMS EACH.")
|
||||||
|
await get_tree().create_timer(2.5, false).timeout
|
||||||
|
dialogue.ShowText_Forever("MORE ITEMS BEFORE\nEVERY LOAD.")
|
||||||
|
await get_tree().create_timer(2.5, false).timeout
|
||||||
|
dialogue.HideText()
|
||||||
|
roundManager.playerData.hasReadItemDistributionIntro = true
|
||||||
|
|
||||||
|
if (!roundManager.playerData.hasReadItemDistributionIntro2 && roundManager.roundArray[roundManager.currentRound].hasIntro2):
|
||||||
|
var stringIndex = roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab
|
||||||
|
var string = stringNumberArray[stringIndex]
|
||||||
|
dialogue.ShowText_Forever(string+" ITEMS EACH.")
|
||||||
|
await get_tree().create_timer(2.5, false).timeout
|
||||||
|
dialogue.HideText()
|
||||||
|
roundManager.playerData.hasReadItemDistributionIntro2 = true
|
||||||
|
#ALLOW ITEM GRAB
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
interaction_intake.interactionAllowed = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func EndItemGrabbing():
|
||||||
|
GrabItems_Enemy()
|
||||||
|
GridParents(false)
|
||||||
|
interaction_intake.interactionAllowed = false
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
await get_tree().create_timer(.45, false).timeout
|
||||||
|
comp.CycleCompartment("hide briefcase")
|
||||||
|
await get_tree().create_timer(1, false).timeout
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
await get_tree().create_timer(.9, false).timeout
|
||||||
|
moving = false
|
||||||
|
roundManager.ReturnFromItemGrabbing()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func GrabSpook():
|
||||||
|
interaction_intake.interactionAllowed = false
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
PlayItemGrabSound()
|
||||||
|
speakercontroller_musicmain.SnapVolume(false)
|
||||||
|
speaker_god.play()
|
||||||
|
anim_spook.play("grab form")
|
||||||
|
await get_tree().create_timer(2 + .8, false).timeout
|
||||||
|
anim_spook.play("put back")
|
||||||
|
PlayItemGrabSound()
|
||||||
|
camera.BeginLerp("briefcase")
|
||||||
|
speaker_god.stop()
|
||||||
|
speakercontroller_musicmain.FadeIn()
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
interaction_intake.interactionAllowed = true
|
||||||
|
|
||||||
|
var randindex = -1
|
||||||
|
var spook_counter = 0
|
||||||
|
var spook_fired = false
|
||||||
|
func GrabItem():
|
||||||
|
if (roundManager.playerData.currentBatchIndex == 1 && roundManager.currentRound == 1):
|
||||||
|
if (spook_counter == 1 && !spook_fired && !roundManager.playerData.seenGod):
|
||||||
|
GrabSpook()
|
||||||
|
roundManager.playerData.seenGod = true
|
||||||
|
spook_fired = true
|
||||||
|
return
|
||||||
|
spook_counter += 1
|
||||||
|
#GET RANDOM ITEM
|
||||||
|
PlayItemGrabSound()
|
||||||
|
interaction_intake.interactionAllowed = false
|
||||||
|
var selectedResource : ItemResource
|
||||||
|
if (numberOfCigs_player >= 2):
|
||||||
|
availableItemsToGrabArray_player.erase("cigarettes")
|
||||||
|
else:
|
||||||
|
var hasInArray = false
|
||||||
|
for i in range(availableItemsToGrabArray_player.size()):
|
||||||
|
if (availableItemsToGrabArray_dealer[i] == "cigarettes"):
|
||||||
|
hasInArray = true
|
||||||
|
break
|
||||||
|
if (!hasInArray): availableItemsToGrabArray_player.append("cigarettes")
|
||||||
|
randindex = randi_range(0, availableItemsToGrabArray_player.size() - 1)
|
||||||
|
numberOfItemsGrabbed += 1
|
||||||
|
#SPAWN ITEM
|
||||||
|
for i in range(instanceArray.size()):
|
||||||
|
if (availableItemsToGrabArray_player[randindex] == instanceArray[i].itemName):
|
||||||
|
selectedResource = instanceArray[i]
|
||||||
|
var itemInstance = selectedResource.instance.instantiate()
|
||||||
|
activeItem = itemInstance
|
||||||
|
itemSpawnParent.add_child(itemInstance)
|
||||||
|
itemInstance.transform.origin = selectedResource.pos_inBriefcase
|
||||||
|
itemInstance.rotation_degrees = selectedResource.rot_inBriefcase
|
||||||
|
activeItem_offset_pos = selectedResource.pos_offset
|
||||||
|
activeItem_offset_rot = selectedResource.rot_offset
|
||||||
|
#ADD ITEM TO PICKUP INDICATOR & INTERACTION BRANCH ARRAY
|
||||||
|
if (numberOfOccupiedGrids != 8):
|
||||||
|
temp_indicator = activeItem.get_child(0)
|
||||||
|
temp_interaction = activeItem.get_child(1)
|
||||||
|
items_dynamicIndicatorArray.append(temp_indicator)
|
||||||
|
items_dynamicInteractionArray.append(temp_interaction)
|
||||||
|
var ind = items_dynamicIndicatorArray.size() - 1
|
||||||
|
temp_indicator.locationInDynamicArray = ind
|
||||||
|
#DISABLE ITEM COLLIDER
|
||||||
|
var childArray = activeItem.get_children()
|
||||||
|
for i in childArray.size():
|
||||||
|
if (childArray[i] is StaticBody3D): childArray[i].get_child(0).disabled = true
|
||||||
|
#LERP TO HAND
|
||||||
|
pos_current = itemInstance.transform.origin
|
||||||
|
rot_current = itemInstance.rotation_degrees
|
||||||
|
pos_next = selectedResource.pos_inHand
|
||||||
|
rot_next = selectedResource.rot_inHand
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
await get_tree().create_timer(lerpDuration - .2, false).timeout
|
||||||
|
if (!roundManager.playerData.indicatorShown): grid.ShowGridIndicator()
|
||||||
|
if (numberOfOccupiedGrids != 8):
|
||||||
|
GridParents(true)
|
||||||
|
else:
|
||||||
|
#NOT ENOUGH SPACE. PUT ITEM BACK AND END ITEM GRABBING
|
||||||
|
dialogue.ShowText_Forever("OUT OF SPACE.")
|
||||||
|
await get_tree().create_timer(1.8, false).timeout
|
||||||
|
dialogue.ShowText_Forever("HOW UNFORTUNATE ...")
|
||||||
|
await get_tree().create_timer(2.2, false).timeout
|
||||||
|
dialogue.HideText()
|
||||||
|
pos_current = activeItem.transform.origin
|
||||||
|
rot_current = activeItem.rotation_degrees
|
||||||
|
pos_next = selectedResource.pos_inBriefcase
|
||||||
|
rot_next = selectedResource.rot_inBriefcase
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
PlayItemGrabSound()
|
||||||
|
await get_tree().create_timer(lerpDuration, false).timeout
|
||||||
|
moving = false
|
||||||
|
activeItem.queue_free()
|
||||||
|
EndItemGrabbing()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func PlaceDownItem(gridIndex : int):
|
||||||
|
numberOfOccupiedGrids += 1
|
||||||
|
gridOccupiedArray[gridIndex] = true
|
||||||
|
moving = false
|
||||||
|
#activeItem.get_parent().remove_child(activeItem)
|
||||||
|
#gridParentArray[gridIndex].add_child(activeItem)
|
||||||
|
var temp_indicator = activeItem.get_child(0)
|
||||||
|
if (temp_interaction.itemName == "cigarettes"): numberOfCigs_player += 1
|
||||||
|
pos_current = activeItem.transform.origin
|
||||||
|
rot_current = activeItem.rotation_degrees
|
||||||
|
pos_next = gridParentArray[gridIndex].transform.origin + activeItem_offset_pos
|
||||||
|
rot_next = gridParentArray[gridIndex].rotation_degrees + activeItem_offset_rot
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
temp_interaction.itemGridIndex = gridIndex
|
||||||
|
if (temp_indicator.sound_placeDown != null):
|
||||||
|
speaker_placedown.stream = temp_indicator.sound_placeDown
|
||||||
|
speaker_placedown.play()
|
||||||
|
var childArray = activeItem.get_children()
|
||||||
|
for i in childArray.size():
|
||||||
|
if (childArray[i] is StaticBody3D): childArray[i].get_child(0).disabled = false
|
||||||
|
if (numberOfItemsGrabbed == roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab):
|
||||||
|
#END ITEM GRABBING
|
||||||
|
EndItemGrabbing()
|
||||||
|
else:
|
||||||
|
#GRAB NEXT ITEM
|
||||||
|
GridParents(false)
|
||||||
|
await get_tree().create_timer(lerpDuration, false).timeout
|
||||||
|
interaction_intake.interactionAllowed = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
var firstItem = true
|
||||||
|
func GrabItems_Enemy():
|
||||||
|
var selectedResource
|
||||||
|
for i in range(roundManager.roundArray[roundManager.currentRound].numberOfItemsToGrab):
|
||||||
|
if (numberOfItemsGrabbed_enemy != 8):
|
||||||
|
if (numberOfCigs_dealer >= 2):
|
||||||
|
availableItemsToGrabArray_dealer.erase("cigarettes")
|
||||||
|
else:
|
||||||
|
var hasInArray = false
|
||||||
|
for k in range(availableItemsToGrabArray_dealer.size()):
|
||||||
|
if (availableItemsToGrabArray_dealer[k] == "cigarettes"):
|
||||||
|
hasInArray = true
|
||||||
|
break
|
||||||
|
if (!hasInArray): availableItemsToGrabArray_dealer.append("cigarettes")
|
||||||
|
|
||||||
|
var randindex = randi_range(0, availableItemsToGrabArray_dealer.size() - 1)
|
||||||
|
#SPAWN ITEM
|
||||||
|
for c in range(instanceArray_dealer.size()):
|
||||||
|
if (availableItemArray[randindex] == instanceArray_dealer[c].itemName):
|
||||||
|
selectedResource = instanceArray_dealer[c]
|
||||||
|
#ADD STRING TO DEALER ITEM ARRAY
|
||||||
|
itemArray_dealer.append(instanceArray_dealer[c].itemName)
|
||||||
|
var itemInstance = selectedResource.instance.instantiate()
|
||||||
|
var temp_itemIndicator = itemInstance.get_child(0)
|
||||||
|
temp_itemIndicator.isDealerItem = true
|
||||||
|
#ADD INSTANCE TO DEALER ITEM ARRAY (mida vittu this code is getting out of hand)
|
||||||
|
itemArray_instances_dealer.append(itemInstance)
|
||||||
|
activeItem_enemy = itemInstance
|
||||||
|
itemSpawnParent.add_child(activeItem_enemy)
|
||||||
|
#PLACE ITEM ON RANDOM GRID
|
||||||
|
var randgrid = randi_range(0, gridParentArray_enemy_available.size() - 1)
|
||||||
|
#higher than z0 is right
|
||||||
|
var gridname = gridParentArray_enemy_available[randgrid]
|
||||||
|
activeItem_enemy.transform.origin = gridParentArray_enemy_available[randgrid].transform.origin + selectedResource.pos_offset
|
||||||
|
activeItem_enemy.rotation_degrees = gridParentArray_enemy_available[randgrid].rotation_degrees + selectedResource.rot_offset
|
||||||
|
if (activeItem_enemy.transform.origin.z > 0): temp_itemIndicator.whichSide = "right"
|
||||||
|
else: temp_itemIndicator.whichSide = "left"
|
||||||
|
temp_itemIndicator.dealerGridIndex = gridParentArray_enemy_available[randgrid].get_child(0).activeIndex
|
||||||
|
temp_itemIndicator.dealerGridName = gridname
|
||||||
|
if (activeItem_enemy.get_child(1).itemName == "cigarettes"): numberOfCigs_dealer += 1
|
||||||
|
gridParentArray_enemy_available.erase(gridname)
|
||||||
|
numberOfItemsGrabbed_enemy += 1
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
|
||||||
|
func UseItem_Dealer(itemName : String):
|
||||||
|
match (itemName):
|
||||||
|
"beer":
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
|
||||||
|
func ResetDealerGrid():
|
||||||
|
#CLEAR DEALER GRID
|
||||||
|
numberOfItemsGrabbed_enemy = 0
|
||||||
|
gridParentArray_enemy_available = []
|
||||||
|
for i in range(gridParentArray_enemy.size()):
|
||||||
|
gridParentArray_enemy_available.append(gridParentArray_enemy[i])
|
||||||
|
|
||||||
|
func SetupItemClear():
|
||||||
|
instancesToDelete = []
|
||||||
|
#DEALER
|
||||||
|
numberOfCigs_dealer = 0
|
||||||
|
numberOfItemsGrabbed_enemy = 0
|
||||||
|
gridParentArray_enemy_available = []
|
||||||
|
for i in range(gridParentArray_enemy.size()):
|
||||||
|
gridParentArray_enemy_available.append(gridParentArray_enemy[i])
|
||||||
|
itemArray_dealer = []
|
||||||
|
|
||||||
|
#PLAYER
|
||||||
|
numberOfCigs_player = 0
|
||||||
|
items_dynamicIndicatorArray = []
|
||||||
|
items_dynamicInteractionArray = []
|
||||||
|
for i in range(gridOccupiedArray.size()):
|
||||||
|
gridOccupiedArray[i] = false
|
||||||
|
numberOfOccupiedGrids = 0
|
||||||
|
|
||||||
|
var childarray = itemSpawnParent.get_children()
|
||||||
|
for i in range(childarray.size()):
|
||||||
|
if (childarray[i].get_child(0) is PickupIndicator):
|
||||||
|
instancesToDelete.append(childarray[i])
|
||||||
|
|
||||||
|
var spawnChildren = itemSpawnParent.get_children()
|
||||||
|
#PARENT INSTANCES TO APPROPRIATE GRID COMPARTMENT PARENT
|
||||||
|
for i in range(spawnChildren.size()):
|
||||||
|
if (spawnChildren[i].get_child(0) is PickupIndicator):
|
||||||
|
var objPos_x = spawnChildren[i].transform.origin.x
|
||||||
|
var objPos_z = spawnChildren[i].transform.origin.z
|
||||||
|
if (objPos_x < 0 && objPos_z > 0):
|
||||||
|
var orig = spawnChildren[i].global_transform
|
||||||
|
spawnChildren[i].get_parent().remove_child(spawnChildren[i])
|
||||||
|
gridParent_1.add_child(spawnChildren[i])
|
||||||
|
spawnChildren[i].global_transform = orig
|
||||||
|
if (objPos_x < 0 && objPos_z < 0):
|
||||||
|
var orig = spawnChildren[i].global_transform
|
||||||
|
spawnChildren[i].get_parent().remove_child(spawnChildren[i])
|
||||||
|
gridParent_2.add_child(spawnChildren[i])
|
||||||
|
spawnChildren[i].global_transform = orig
|
||||||
|
if (objPos_x > 0 && objPos_z > 0):
|
||||||
|
var orig = spawnChildren[i].global_transform
|
||||||
|
spawnChildren[i].get_parent().remove_child(spawnChildren[i])
|
||||||
|
gridParent_3.add_child(spawnChildren[i])
|
||||||
|
spawnChildren[i].global_transform = orig
|
||||||
|
if (objPos_x > 0 && objPos_z < 0):
|
||||||
|
var orig = spawnChildren[i].global_transform
|
||||||
|
spawnChildren[i].get_parent().remove_child(spawnChildren[i])
|
||||||
|
gridParent_4.add_child(spawnChildren[i])
|
||||||
|
spawnChildren[i].global_transform = orig
|
||||||
|
|
||||||
|
var instancesToDelete = []
|
||||||
|
func ClearAllItems():
|
||||||
|
#DELETE INSTANCES
|
||||||
|
for i in range (instancesToDelete.size()):
|
||||||
|
instancesToDelete[i].queue_free()
|
||||||
|
itemArray_instances_dealer = []
|
||||||
|
|
||||||
|
func GridParents(setState : bool):
|
||||||
|
if (setState):
|
||||||
|
for i in range(gridParentArray.size()):
|
||||||
|
gridParentArray[i].get_child(1).get_child(0).disabled = false
|
||||||
|
if(gridOccupiedArray[i] == false): gridParentArray[i].get_child(0).interactionAllowed = true
|
||||||
|
else:
|
||||||
|
for i in range(gridParentArray.size()):
|
||||||
|
gridParentArray[i].get_child(1).get_child(0).disabled = true
|
||||||
|
gridParentArray[i].get_child(0).interactionAllowed = false
|
||||||
|
|
||||||
|
func PlayItemGrabSound():
|
||||||
|
speaker_itemgrab.stream = soundArray_itemGrab[itemGrabSoundIndex]
|
||||||
|
speaker_itemgrab.play()
|
||||||
|
if (itemGrabSoundIndex != soundArray_itemGrab.size() - 1): itemGrabSoundIndex += 1
|
||||||
|
else: itemGrabSoundIndex = 0
|
||||||
|
pass
|
||||||
|
|
||||||
|
func LerpItem():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / lerpDuration, 0.0, 1.0)
|
||||||
|
c = ease(c, 0.4)
|
||||||
|
var pos = lerp(pos_current, pos_next, c)
|
||||||
|
var rot = lerp(rot_current, rot_next, c)
|
||||||
|
activeItem.transform.origin = pos
|
||||||
|
activeItem.rotation_degrees = rot
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
ItemProperties.gd
Normal file
6
ItemProperties.gd
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class_name ItemProperties extends Node
|
||||||
|
|
||||||
|
@export var pos_inBriefcase : Vector3
|
||||||
|
@export var rot_inBriefcase : Vector3
|
||||||
|
@export var pos_inHand : Vector3
|
||||||
|
@export var rot_inHand : Vector3
|
10
ItemResource.gd
Normal file
10
ItemResource.gd
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class_name ItemResource extends Resource
|
||||||
|
|
||||||
|
@export var itemName : String
|
||||||
|
@export var instance : PackedScene
|
||||||
|
@export var pos_inHand : Vector3
|
||||||
|
@export var rot_inHand : Vector3
|
||||||
|
@export var pos_inBriefcase : Vector3
|
||||||
|
@export var rot_inBriefcase : Vector3
|
||||||
|
@export var pos_offset : Vector3
|
||||||
|
@export var rot_offset : Vector3
|
88
MenuManager.gd
Normal file
88
MenuManager.gd
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
class_name MenuManager extends Node
|
||||||
|
|
||||||
|
@export var savefile : SaveFileManager
|
||||||
|
@export var cursor : CursorManager
|
||||||
|
@export var animator_intro : AnimationPlayer
|
||||||
|
@export var speaker_music : AudioStreamPlayer2D
|
||||||
|
@export var speaker_start : AudioStreamPlayer2D
|
||||||
|
@export var buttons : Array[ButtonClass]
|
||||||
|
@export var screen_main : Array[Control]
|
||||||
|
@export var screen_creds : Array[Control]
|
||||||
|
@export var title : Node3D
|
||||||
|
@export var waterfalls : Array[AnimationPlayer]
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
Show("main")
|
||||||
|
buttons[0].connect("is_pressed", Start)
|
||||||
|
buttons[1].connect("is_pressed", Credits)
|
||||||
|
buttons[2].connect("is_pressed", Exit)
|
||||||
|
buttons[3].connect("is_pressed", Return)
|
||||||
|
Intro()
|
||||||
|
|
||||||
|
func Intro():
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
speaker_music.play()
|
||||||
|
animator_intro.play("splash screen")
|
||||||
|
await get_tree().create_timer(9, false).timeout
|
||||||
|
cursor.SetCursor(true, false)
|
||||||
|
buttons[0].isActive = true
|
||||||
|
buttons[1].isActive = true
|
||||||
|
buttons[2].isActive = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func Buttons(state : bool):
|
||||||
|
if (!state):
|
||||||
|
for i in buttons: i.isActive = false
|
||||||
|
else: for i in buttons: i.isActive = true
|
||||||
|
|
||||||
|
func Show(what : String):
|
||||||
|
title.visible = false
|
||||||
|
for i in screen_main: i.visible = false
|
||||||
|
for i in screen_creds: i.visible = false
|
||||||
|
if (what == "credits"): for i in screen_creds: i.visible = true
|
||||||
|
else: if (what == "main"):
|
||||||
|
for i in screen_main: i.visible = true
|
||||||
|
title.visible = true
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
func ResetButtons():
|
||||||
|
for b in buttons:
|
||||||
|
b.ui.modulate.a = 1
|
||||||
|
cursor.SetCursorImage("point")
|
||||||
|
|
||||||
|
func Start():
|
||||||
|
Buttons(false)
|
||||||
|
ResetButtons()
|
||||||
|
Show("e")
|
||||||
|
speaker_music.stop()
|
||||||
|
animator_intro.play("snap")
|
||||||
|
for w in waterfalls: w.pause()
|
||||||
|
speaker_start.play()
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
savefile.ClearSave()
|
||||||
|
await get_tree().create_timer(4, false).timeout
|
||||||
|
get_tree().change_scene_to_file("res://scenes/main.tscn")
|
||||||
|
|
||||||
|
func Credits():
|
||||||
|
ResetButtons()
|
||||||
|
Show("credits")
|
||||||
|
Buttons(false)
|
||||||
|
buttons[3].isActive = true
|
||||||
|
ResetButtons()
|
||||||
|
|
||||||
|
func Exit():
|
||||||
|
Buttons(false)
|
||||||
|
ResetButtons()
|
||||||
|
speaker_music.stop()
|
||||||
|
animator_intro.play("snap2")
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
get_tree().quit()
|
||||||
|
|
||||||
|
func Return():
|
||||||
|
Show("main")
|
||||||
|
Buttons(true)
|
||||||
|
buttons[3].isActive = false
|
||||||
|
ResetButtons()
|
17
MouseRaycast.gd
Normal file
17
MouseRaycast.gd
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
class_name MouseRaycast extends Camera3D
|
||||||
|
|
||||||
|
var mouse = Vector2()
|
||||||
|
var result = null
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventMouse:
|
||||||
|
mouse = event.position
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
get_selection()
|
||||||
|
|
||||||
|
func get_selection():
|
||||||
|
var worldspace = get_world_3d().direct_space_state
|
||||||
|
var start = project_ray_origin(mouse)
|
||||||
|
var end = project_position(mouse, 20000)
|
||||||
|
result = worldspace.intersect_ray(PhysicsRayQueryParameters3D.create(start, end))
|
34
MusicManager.gd
Normal file
34
MusicManager.gd
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
class_name MusicManager extends Node
|
||||||
|
|
||||||
|
@export var trackArray : Array[TrackInstance]
|
||||||
|
@export var speaker_music : AudioStreamPlayer2D
|
||||||
|
@export var speakerController_music : SpeakerController
|
||||||
|
@export var filter : FilterController
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
#LoadTrack()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func EndTrack():
|
||||||
|
speaker_music.stop()
|
||||||
|
|
||||||
|
func LoadTrack_FadeIn():
|
||||||
|
speakerController_music.SnapVolume(false)
|
||||||
|
LoadTrack()
|
||||||
|
speakerController_music.FadeIn()
|
||||||
|
|
||||||
|
var trackset = false
|
||||||
|
func LoadTrack():
|
||||||
|
var currentBatch = roundManager.playerData.currentBatchIndex
|
||||||
|
var currentTrack
|
||||||
|
if (roundManager.playerData.playerEnteringFromDeath && !trackset):
|
||||||
|
currentTrack = trackArray[currentBatch].audiofile_secondloop
|
||||||
|
trackset = true
|
||||||
|
else:
|
||||||
|
currentTrack = trackArray[currentBatch].audiofile
|
||||||
|
filter.lowPassDefaultValue = trackArray[currentBatch].defaultLowPassHz
|
||||||
|
filter.effect_lowPass.cutoff_hz = filter.lowPassDefaultValue
|
||||||
|
filter.moving = false
|
||||||
|
speaker_music.stream = currentTrack
|
||||||
|
speaker_music.play()
|
28
ObjectShaker.gd
Normal file
28
ObjectShaker.gd
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
class_name ObjectShaker extends Node
|
||||||
|
|
||||||
|
@export var obj : Node3D
|
||||||
|
@export var delay : float
|
||||||
|
@export var offset_1 : float
|
||||||
|
@export var offset_2 : float
|
||||||
|
|
||||||
|
var originalPos : Vector3
|
||||||
|
var shaking = false
|
||||||
|
|
||||||
|
func StartShaking():
|
||||||
|
originalPos = obj.transform.origin
|
||||||
|
shaking = true
|
||||||
|
ShakeRoutine()
|
||||||
|
|
||||||
|
func StopShaking():
|
||||||
|
shaking = false
|
||||||
|
obj.transform.origin = originalPos
|
||||||
|
|
||||||
|
func ShakeRoutine():
|
||||||
|
while(shaking):
|
||||||
|
var val = randf_range(offset_1, offset_2)
|
||||||
|
var pos = Vector3(obj.transform.origin.x + val, obj.transform.origin.y + val, obj.transform.origin.z + val)
|
||||||
|
obj.transform.origin = pos
|
||||||
|
await get_tree().create_timer(delay, false).timeout
|
||||||
|
obj.transform.origin = originalPos
|
||||||
|
await get_tree().create_timer(delay, false).timeout
|
||||||
|
pass
|
69
PermissionManager.gd
Normal file
69
PermissionManager.gd
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
class_name PermissionManager extends Node
|
||||||
|
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var itemManager : ItemManager
|
||||||
|
@export var indicatorArray : Array[PickupIndicator]
|
||||||
|
@export var interactionBranchArray : Array[InteractionBranch]
|
||||||
|
@export var description : DescriptionManager
|
||||||
|
@export var userItemsParent : Node3D
|
||||||
|
@export var stackDisabledItemArray : Array[String]
|
||||||
|
@export var stackDisabledItemArray_bools : Array[bool]
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
#SetItemInteraction(true)
|
||||||
|
pass
|
||||||
|
|
||||||
|
func SetIndicators(state : bool):
|
||||||
|
if (state):
|
||||||
|
for i in range(indicatorArray.size()):
|
||||||
|
indicatorArray[i].interactionAllowed = true
|
||||||
|
if (!state):
|
||||||
|
for i in range(indicatorArray.size()):
|
||||||
|
indicatorArray[i].interactionAllowed = false
|
||||||
|
indicatorArray[i].moving = false
|
||||||
|
|
||||||
|
func SetInteractionPermissions(state : bool):
|
||||||
|
if (state):
|
||||||
|
for i in range(interactionBranchArray.size()):
|
||||||
|
interactionBranchArray[i].interactionAllowed = true
|
||||||
|
if (!state):
|
||||||
|
for i in range(interactionBranchArray.size()):
|
||||||
|
interactionBranchArray[i].interactionAllowed = false
|
||||||
|
if (roundManager.roundArray[roundManager.currentRound].usingItems && itemManager.items_dynamicIndicatorArray.size() != 0):
|
||||||
|
if (state):
|
||||||
|
for i in range(itemManager.items_dynamicInteractionArray.size()):
|
||||||
|
itemManager.items_dynamicInteractionArray[i].interactionAllowed = true
|
||||||
|
itemManager.items_dynamicIndicatorArray[i].interactionAllowed = true
|
||||||
|
else:
|
||||||
|
for i in range(itemManager.items_dynamicInteractionArray.size()):
|
||||||
|
itemManager.items_dynamicInteractionArray[i].interactionAllowed = false
|
||||||
|
itemManager.items_dynamicIndicatorArray[i].interactionAllowed = false
|
||||||
|
|
||||||
|
func SetItemInteraction(state : bool):
|
||||||
|
var children = userItemsParent.get_children()
|
||||||
|
for i in range(children.size()):
|
||||||
|
if (children[i].get_child(0) != null):
|
||||||
|
if (children[i].get_child(0) is PickupIndicator):
|
||||||
|
var tempindicator : PickupIndicator = children[i].get_child(0)
|
||||||
|
tempindicator.interactionAllowed = state
|
||||||
|
if (children[i].get_child(1) is InteractionBranch):
|
||||||
|
var tempBranch : InteractionBranch = children[i].get_child(1)
|
||||||
|
tempBranch.interactionAllowed = state
|
||||||
|
|
||||||
|
func SetStackInvalidIndicators():
|
||||||
|
if (roundManager.dealerCuffed): stackDisabledItemArray_bools[4] = true
|
||||||
|
else: stackDisabledItemArray_bools[4] = false
|
||||||
|
if (roundManager.barrelSawedOff): stackDisabledItemArray_bools[0] = true
|
||||||
|
else: stackDisabledItemArray_bools[0] = false
|
||||||
|
if (roundManager.roundArray[roundManager.currentRound].usingItems && itemManager.items_dynamicIndicatorArray.size() != 0):
|
||||||
|
for i in range(stackDisabledItemArray.size()):
|
||||||
|
for c in range(itemManager.items_dynamicInteractionArray.size()):
|
||||||
|
if (itemManager.items_dynamicInteractionArray[c].itemName == stackDisabledItemArray[i] && stackDisabledItemArray_bools[i]):
|
||||||
|
itemManager.items_dynamicInteractionArray[c].interactionInvalid = true
|
||||||
|
itemManager.items_dynamicIndicatorArray[c].interactionInvalid = true
|
||||||
|
if (itemManager.items_dynamicInteractionArray[c].itemName == stackDisabledItemArray[i] && !stackDisabledItemArray_bools[i]):
|
||||||
|
itemManager.items_dynamicInteractionArray[c].interactionInvalid = false
|
||||||
|
itemManager.items_dynamicIndicatorArray[c].interactionInvalid = false
|
||||||
|
|
||||||
|
func RevertDescriptionUI():
|
||||||
|
description.EndLerp()
|
133
PickupIndicator.gd
Normal file
133
PickupIndicator.gd
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
class_name PickupIndicator extends Node
|
||||||
|
|
||||||
|
@export var description : DescriptionManager
|
||||||
|
@export var interaction : InteractionManager
|
||||||
|
@export var obj : Node3D
|
||||||
|
@export var collider : Node3D
|
||||||
|
|
||||||
|
@export var dur : float
|
||||||
|
@export var axisOffset : float
|
||||||
|
@export var originalAxis : float
|
||||||
|
@export var activeAxis : String
|
||||||
|
|
||||||
|
@export var uiArray : Array[Label]
|
||||||
|
@export var itemName : String
|
||||||
|
@export_multiline var itemDescription : String
|
||||||
|
@export var whichSide : String
|
||||||
|
@export var dealerGridIndex : int
|
||||||
|
@export var sound_placeDown : AudioStream
|
||||||
|
@export var sound_indicatorPickup : AudioStream
|
||||||
|
@export var sound_indicatorPutdown : AudioStream
|
||||||
|
@export var sound_pickup : AudioStream
|
||||||
|
var speaker_indicatorCheck : AudioStreamPlayer2D
|
||||||
|
var locationInDynamicArray
|
||||||
|
var itemManager
|
||||||
|
|
||||||
|
var isDealerItem = false
|
||||||
|
var dealerGridName
|
||||||
|
var lerpEnabled = true
|
||||||
|
var interactionAllowed = false
|
||||||
|
var interactionInvalid = false
|
||||||
|
var current = 0
|
||||||
|
var next = 0
|
||||||
|
var elapsed = 0
|
||||||
|
var moving = false
|
||||||
|
var fs = false
|
||||||
|
var fs2 = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
speaker_indicatorCheck = get_node("/root/main/speaker parent/speaker_indicator check")
|
||||||
|
interaction = get_node("/root/main/standalone managers/interaction manager")
|
||||||
|
description = get_node("/root/main/standalone managers/description manager")
|
||||||
|
itemManager = get_node("/root/main/standalone managers/item manager")
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if (lerpEnabled): LerpMovement()
|
||||||
|
CheckIfActive()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func CheckIfActive():
|
||||||
|
if (interactionAllowed && !interactionInvalid):
|
||||||
|
if (interaction.activeParent != null and interaction.activeParent == collider):
|
||||||
|
if (!fs):
|
||||||
|
BeginPickup()
|
||||||
|
fs2 = false
|
||||||
|
fs = true
|
||||||
|
if (interaction.activeParent != collider):
|
||||||
|
if (!fs2):
|
||||||
|
Revert()
|
||||||
|
fs = false
|
||||||
|
fs2 = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func BeginPickup():
|
||||||
|
speaker_indicatorCheck.pitch_scale = randf_range(.9, 1.0)
|
||||||
|
speaker_indicatorCheck.play()
|
||||||
|
current = originalAxis
|
||||||
|
next = axisOffset
|
||||||
|
description.uiArray[0].text = itemName
|
||||||
|
description.uiArray[1].text = itemName
|
||||||
|
description.uiArray[2].text = itemDescription
|
||||||
|
description.uiArray[3].text = itemDescription
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
description.BeginLerp()
|
||||||
|
itemManager.hasBegun = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func Revert():
|
||||||
|
#if (itemManager.hasBegun): description.EndLerp()
|
||||||
|
itemManager.hasBegun = false
|
||||||
|
match(activeAxis):
|
||||||
|
"x":
|
||||||
|
current = obj.transform.origin.x
|
||||||
|
"y":
|
||||||
|
current = obj.transform.origin.y
|
||||||
|
"z":
|
||||||
|
current = obj.transform.origin.z
|
||||||
|
next = originalAxis
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func LerpMovement():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / dur, 0.0, 1.0)
|
||||||
|
var pos = lerp(current, next, c)
|
||||||
|
match(activeAxis):
|
||||||
|
"x":
|
||||||
|
obj.transform.origin = Vector3(pos, obj.transform.origin.y, obj.transform.origin.z)
|
||||||
|
"y":
|
||||||
|
obj.transform.origin = Vector3(obj.transform.origin.x, pos, obj.transform.origin.z)
|
||||||
|
"z":
|
||||||
|
obj.transform.origin = Vector3(obj.transform.origin.x, obj.transform.origin.y, pos)
|
||||||
|
|
||||||
|
func SnapToMax():
|
||||||
|
match(activeAxis):
|
||||||
|
"x":
|
||||||
|
obj.transform.origin = Vector3(axisOffset, obj.transform.origin.y, obj.transform.origin.z)
|
||||||
|
"y":
|
||||||
|
obj.transform.origin = Vector3(obj.transform.origin.x, axisOffset, obj.transform.origin.z)
|
||||||
|
"z":
|
||||||
|
obj.transform.origin = Vector3(obj.transform.origin.x, obj.transform.origin.y, axisOffset)
|
||||||
|
|
||||||
|
func SnapToMin():
|
||||||
|
match(activeAxis):
|
||||||
|
"x":
|
||||||
|
obj.transform.origin = Vector3(originalAxis, obj.transform.origin.y, obj.transform.origin.z)
|
||||||
|
"y":
|
||||||
|
obj.transform.origin = Vector3(obj.transform.origin.x, originalAxis, obj.transform.origin.z)
|
||||||
|
"z":
|
||||||
|
obj.transform.origin = Vector3(obj.transform.origin.x, obj.transform.origin.y, originalAxis)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
3
PlayerCameraTest.gd
Normal file
3
PlayerCameraTest.gd
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class_name PlayerCameraTest extends Node
|
||||||
|
|
||||||
|
@export var cameraManager : CameraManager
|
23
PlayerData.gd
Normal file
23
PlayerData.gd
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
class_name PlayerData extends Resource
|
||||||
|
|
||||||
|
@export var hasReadIntroduction : bool
|
||||||
|
@export var hasReadItemSwapIntroduction : bool
|
||||||
|
@export var hasReadItemDistributionIntro : bool
|
||||||
|
@export var hasReadItemDistributionIntro2 : bool
|
||||||
|
@export var currentBatchIndex : int
|
||||||
|
@export var playerEnteringFromDeath : bool
|
||||||
|
@export var testValue : int
|
||||||
|
@export var numberOfDialogueRead : int
|
||||||
|
@export var skippingShellDescription : bool
|
||||||
|
@export var indicatorShown : bool
|
||||||
|
@export var cutterDialogueRead : bool
|
||||||
|
@export var enteringFromTrueDeath : bool
|
||||||
|
@export var hasSignedWaiver : bool
|
||||||
|
@export var seenHint : bool
|
||||||
|
@export var seenGod : bool
|
||||||
|
@export var playername : String
|
||||||
|
@export var stat_shotsFired : int
|
||||||
|
@export var stat_shellsEjected : int
|
||||||
|
@export var stat_doorsKicked : int
|
||||||
|
@export var stat_cigSmoked : int
|
||||||
|
@export var stat_beerDrank : int
|
4
RoundBatch.gd
Normal file
4
RoundBatch.gd
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
class_name RoundBatch extends Node
|
||||||
|
|
||||||
|
@export var batchIndex : int
|
||||||
|
@export var roundArray : Array[RoundClass]
|
24
RoundClass.gd
Normal file
24
RoundClass.gd
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
class_name RoundClass extends Resource
|
||||||
|
|
||||||
|
@export var hasIntroductoryText : bool
|
||||||
|
@export var isFirstRound : bool
|
||||||
|
@export var startingHealth : int
|
||||||
|
@export var roundIndex : int
|
||||||
|
@export var amountBlank : int
|
||||||
|
@export var amountLive : int
|
||||||
|
@export var usingItems : bool
|
||||||
|
@export var showingIndicator : bool
|
||||||
|
@export var indicatorNumber: int
|
||||||
|
@export var bootingUpCounter : bool
|
||||||
|
@export var sequenceHidden : bool
|
||||||
|
@export var shufflingArray : bool
|
||||||
|
@export var insertingInRandomOrder : bool
|
||||||
|
@export var numberOfItemsToGrab : int
|
||||||
|
@export var hasIntro2 : bool
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
331
RoundManager.gd
Normal file
331
RoundManager.gd
Normal file
@ -0,0 +1,331 @@
|
|||||||
|
class_name RoundManager extends Node
|
||||||
|
|
||||||
|
@export var sign : Signature
|
||||||
|
@export var brief : BriefcaseMachine
|
||||||
|
@export var defibCutter : DefibCutter
|
||||||
|
@export var segmentManager : SegmentManager
|
||||||
|
@export var handcuffs : HandcuffManager
|
||||||
|
@export var itemManager : ItemManager
|
||||||
|
@export var death : DeathManager
|
||||||
|
@export var playerData : PlayerData
|
||||||
|
@export var cursor : CursorManager
|
||||||
|
@export var perm : PermissionManager
|
||||||
|
@export var health_player : int
|
||||||
|
@export var health_opponent : int
|
||||||
|
@export var batchArray : Array[Node]
|
||||||
|
@export var roundArray : Array[RoundClass]
|
||||||
|
@export var shellSpawner : ShellSpawner
|
||||||
|
@export var shellLoader : ShellLoader
|
||||||
|
@export var currentRound : int
|
||||||
|
var mainBatchIndex : int
|
||||||
|
@export var healthCounter : HealthCounter
|
||||||
|
@export var dealerAI : DealerIntelligence
|
||||||
|
@export var typingManager : TypingManager
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var roundIndicatorPositions : Array[Vector3]
|
||||||
|
@export var roundIndicatorParent : Node3D
|
||||||
|
@export var roundIndicator : Node3D
|
||||||
|
@export var animator_roundIndicator : AnimationPlayer
|
||||||
|
@export var speaker_roundHum : AudioStreamPlayer3D
|
||||||
|
@export var speaker_roundShutDown : AudioStreamPlayer3D
|
||||||
|
@export var speaker_winner : AudioStreamPlayer3D
|
||||||
|
@export var ui_winner : Node3D
|
||||||
|
@export var animator_dealer : AnimationPlayer
|
||||||
|
@export var ejectManagers : Array[ShellEjectManager]
|
||||||
|
@export var animator_dealerHands : AnimationPlayer
|
||||||
|
@export var gameover : GameOverManager
|
||||||
|
@export var musicManager : MusicManager
|
||||||
|
@export var deficutter : DefibCutter
|
||||||
|
|
||||||
|
var shellLoadingSpedUp = false
|
||||||
|
var dealerItems : Array[String]
|
||||||
|
var currentShotgunDamage = 1
|
||||||
|
var dealerAtTable = false
|
||||||
|
var dealerHasGreeted = false
|
||||||
|
var dealerCuffed = false
|
||||||
|
var playerCuffed = false
|
||||||
|
var playerAboutToBreakFree = false
|
||||||
|
var waitingForDealerReturn = false
|
||||||
|
var barrelSawedOff = false
|
||||||
|
var defibCutterReady = false
|
||||||
|
var trueDeathActive = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
HideDealer()
|
||||||
|
#await get_tree().create_timer(.2, false).timeout
|
||||||
|
pass
|
||||||
|
|
||||||
|
func BeginMainGame():
|
||||||
|
MainBatchSetup(true)
|
||||||
|
|
||||||
|
func HideDealer():
|
||||||
|
animator_dealerHands.play("hide hands")
|
||||||
|
animator_dealer.play("hide dealer")
|
||||||
|
|
||||||
|
#MAIN BATCH SETUP
|
||||||
|
var lerping = false
|
||||||
|
var enteringFromWaiver = false
|
||||||
|
func MainBatchSetup(dealerEnterAtStart : bool):
|
||||||
|
if (!enteringFromWaiver):
|
||||||
|
if (lerping): camera.BeginLerp("enemy")
|
||||||
|
currentRound = 0
|
||||||
|
if (!dealerAtTable && dealerEnterAtStart):
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
if (!dealerCuffed): animator_dealerHands.play("dealer hands on table")
|
||||||
|
else: animator_dealerHands.play("dealer hands on table cuffed")
|
||||||
|
animator_dealer.play("dealer return to table")
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
var greeting = true
|
||||||
|
if (!playerData.hasSignedWaiver):
|
||||||
|
shellLoader.dialogue.ShowText_Forever("PLEASE SIGN THE WAIVER.")
|
||||||
|
await get_tree().create_timer(2.3, false).timeout
|
||||||
|
shellLoader.dialogue.HideText()
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
sign.AwaitPickup()
|
||||||
|
return
|
||||||
|
if (!dealerHasGreeted && greeting):
|
||||||
|
var tempstring
|
||||||
|
if (!playerData.enteringFromTrueDeath): tempstring = "WELCOME BACK."
|
||||||
|
else:
|
||||||
|
shellSpawner.dialogue.dealerLowPitched = true
|
||||||
|
tempstring = "..."
|
||||||
|
if (!playerData.playerEnteringFromDeath):
|
||||||
|
shellLoader.dialogue.ShowText_Forever("WELCOME TO\nBUCKSHOT ROULETTE.")
|
||||||
|
await get_tree().create_timer(2.3, false).timeout
|
||||||
|
shellLoader.dialogue.HideText()
|
||||||
|
dealerHasGreeted = true
|
||||||
|
else:
|
||||||
|
shellLoader.dialogue.ShowText_Forever(tempstring)
|
||||||
|
await get_tree().create_timer(2.3, false).timeout
|
||||||
|
shellLoader.dialogue.HideText()
|
||||||
|
dealerHasGreeted = true
|
||||||
|
dealerAtTable = true
|
||||||
|
enteringFromWaiver = false
|
||||||
|
playerData.enteringFromTrueDeath = false
|
||||||
|
mainBatchIndex = playerData.currentBatchIndex
|
||||||
|
healthCounter.DisableCounter()
|
||||||
|
SetupRoundArray()
|
||||||
|
if (playerData.hasReadIntroduction): roundArray[0].hasIntroductoryText = false
|
||||||
|
else: roundArray[0].hasIntroductoryText = true
|
||||||
|
if (roundArray[0].showingIndicator): await(RoundIndicator())
|
||||||
|
healthCounter.SetupHealth()
|
||||||
|
lerping = true
|
||||||
|
#await get_tree().create_timer(1.5, false).timeout
|
||||||
|
StartRound(false)
|
||||||
|
|
||||||
|
#APPEND ROUNDS FROM BATCH
|
||||||
|
func SetupRoundArray():
|
||||||
|
roundArray = []
|
||||||
|
for i in range(batchArray.size()):
|
||||||
|
if (batchArray[i].batchIndex == mainBatchIndex):
|
||||||
|
var matched = batchArray[i]
|
||||||
|
for z in range(matched.roundArray.size()):
|
||||||
|
roundArray.append(matched.roundArray[z])
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
|
||||||
|
#SHOW ROUND INDICATOR
|
||||||
|
func RoundIndicator():
|
||||||
|
roundIndicator.visible = false
|
||||||
|
#await get_tree().create_timer(1.5, false).timeout
|
||||||
|
animator_roundIndicator.play("RESET")
|
||||||
|
camera.BeginLerp("health counter")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
var activePos = roundIndicatorPositions[roundArray[0].indicatorNumber]
|
||||||
|
roundIndicator.transform.origin = activePos
|
||||||
|
roundIndicatorParent.visible = true
|
||||||
|
speaker_roundHum.play()
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
roundIndicator.visible = true
|
||||||
|
animator_roundIndicator.play("round blinking")
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
roundIndicatorParent.visible = false
|
||||||
|
speaker_roundHum.stop()
|
||||||
|
speaker_roundShutDown.play()
|
||||||
|
animator_roundIndicator.play("RESET")
|
||||||
|
pass
|
||||||
|
|
||||||
|
#MAIN ROUND SETUP
|
||||||
|
func StartRound(gettingNext : bool):
|
||||||
|
if (gettingNext && (currentRound + 1) != roundArray.size()): currentRound += 1
|
||||||
|
#USINGITEMS: SETUP ITEM GRIDS IF ROUND CLASS HAS SETUP ITEM GRIDS ENABLED
|
||||||
|
#UNCUFF BOTH PARTIES BEFORE ITEM DISTRIBUTION
|
||||||
|
await (handcuffs.RemoveAllCuffsRoutine())
|
||||||
|
#FINAL SHOWDOWN DIALOGUE
|
||||||
|
if (playerData.currentBatchIndex == 2 && !defibCutterReady):
|
||||||
|
shellLoader.dialogue.dealerLowPitched = true
|
||||||
|
camera.BeginLerp("enemy")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
#var origdelay = shellLoader.dialogue.incrementDelay
|
||||||
|
#shellLoader.dialogue.incrementDelay = .1
|
||||||
|
if (!playerData.cutterDialogueRead):
|
||||||
|
shellLoader.dialogue.ShowText_Forever("LONG LAST, WE ARRIVE\nAT THE FINAL SHOWDOWN.")
|
||||||
|
await get_tree().create_timer(4, false).timeout
|
||||||
|
shellLoader.dialogue.ShowText_Forever("NO MORE DEFIBRILLATORS.\nNO MORE BLOOD TRANSFUSIONS.")
|
||||||
|
await get_tree().create_timer(4, false).timeout
|
||||||
|
shellLoader.dialogue.ShowText_Forever("NOW, ME AND YOU, WE ARE DANCING\nON THE EDGE OF LIFE AND DEATH.")
|
||||||
|
await get_tree().create_timer(4.8, false).timeout
|
||||||
|
shellLoader.dialogue.HideText()
|
||||||
|
playerData.cutterDialogueRead = true
|
||||||
|
else:
|
||||||
|
shellLoader.dialogue.ShowText_Forever("I BETTER NOT\nSEE YOU AGAIN.")
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
shellLoader.dialogue.HideText()
|
||||||
|
await(deficutter.InitialSetup())
|
||||||
|
defibCutterReady = true
|
||||||
|
trueDeathActive = true
|
||||||
|
#await get_tree().create_timer(100, false).timeout
|
||||||
|
#USINGITEMS: SHARE ITEMS TO PLAYERS HERE
|
||||||
|
if (roundArray[currentRound].usingItems):
|
||||||
|
itemManager.BeginItemGrabbing()
|
||||||
|
return
|
||||||
|
shellSpawner.MainShellRoutine()
|
||||||
|
pass
|
||||||
|
|
||||||
|
#MAIN ROUND SETUP AFTER ITEMS HAVE BEEN DISTRIBUTED. RETURN TO HERE FROM ITEM GRABBING INTERACTION
|
||||||
|
func ReturnFromItemGrabbing():
|
||||||
|
shellSpawner.MainShellRoutine()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func LoadShells():
|
||||||
|
shellLoader.LoadShells()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func CheckIfOutOfHealth():
|
||||||
|
#CHECK IF OUT OF HEALTH
|
||||||
|
var outOfHealth_player = health_player == 0
|
||||||
|
var outOfHealth_enemy = health_opponent == 0
|
||||||
|
var outOfHealth = outOfHealth_player or outOfHealth_enemy
|
||||||
|
if (outOfHealth):
|
||||||
|
if (outOfHealth_player): OutOfHealth("player")
|
||||||
|
if (outOfHealth_enemy): OutOfHealth("dealer")
|
||||||
|
return outOfHealth
|
||||||
|
|
||||||
|
var waitingForReturn = false
|
||||||
|
var waitingForHealthCheck = false
|
||||||
|
var waitingForHealthCheck2 = false
|
||||||
|
var requestedWireCut = false
|
||||||
|
var wireToCut = ""
|
||||||
|
var wireIsCut_dealer = false
|
||||||
|
var wireIsCut_player = false
|
||||||
|
|
||||||
|
var ignoring = false
|
||||||
|
func EndTurn(playerCanGoAgain : bool):
|
||||||
|
#USINGITEMS: ASSIGN PLAYER CAN GO AGAIN FROM ITEMS HERE
|
||||||
|
#USINGITEMS: MAKE SHOTGUN GROW NEW BARREL
|
||||||
|
#var isOutOfHealth = CheckIfOutOfHealth()
|
||||||
|
#if (isOutOfHealth): return
|
||||||
|
if (barrelSawedOff):
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
if (waitingForHealthCheck2): await get_tree().create_timer(2, false).timeout
|
||||||
|
waitingForHealthCheck2 = false
|
||||||
|
await(segmentManager.GrowBarrel())
|
||||||
|
if (shellSpawner.sequenceArray.size() != 0):
|
||||||
|
#PLAYER TURN
|
||||||
|
if (playerCanGoAgain):
|
||||||
|
BeginPlayerTurn()
|
||||||
|
else:
|
||||||
|
#DEALER TURN
|
||||||
|
if (!dealerCuffed):
|
||||||
|
dealerAI.BeginDealerTurn()
|
||||||
|
else:
|
||||||
|
if (waitingForReturn):
|
||||||
|
await get_tree().create_timer(1.4, false).timeout
|
||||||
|
waitingForReturn = false
|
||||||
|
if (waitingForHealthCheck):
|
||||||
|
await get_tree().create_timer(1.8, false).timeout
|
||||||
|
waitingForHealthCheck = false
|
||||||
|
dealerAI.DealerCheckHandCuffs()
|
||||||
|
else:
|
||||||
|
#SHOTGUN IS EMPTY. NEXT ROUND
|
||||||
|
if (requestedWireCut):
|
||||||
|
await(defibCutter.CutWire(wireToCut))
|
||||||
|
if (!ignoring):
|
||||||
|
StartRound(true)
|
||||||
|
|
||||||
|
func ReturnFromCuffCheck(brokeFree : bool):
|
||||||
|
if (brokeFree):
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
camera.BeginLerp("enemy")
|
||||||
|
dealerAI.BeginDealerTurn()
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
BeginPlayerTurn()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func BeginPlayerTurn():
|
||||||
|
if (playerCuffed):
|
||||||
|
var returning = false
|
||||||
|
if (playerAboutToBreakFree == false):
|
||||||
|
handcuffs.CheckPlayerHandCuffs(false)
|
||||||
|
await get_tree().create_timer(1.4, false).timeout
|
||||||
|
camera.BeginLerp("enemy")
|
||||||
|
dealerAI.BeginDealerTurn()
|
||||||
|
returning = true
|
||||||
|
playerAboutToBreakFree = true
|
||||||
|
else:
|
||||||
|
handcuffs.BreakPlayerHandCuffs(false)
|
||||||
|
await get_tree().create_timer(1.4, false).timeout
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
playerCuffed = false
|
||||||
|
playerAboutToBreakFree = false
|
||||||
|
returning = false
|
||||||
|
if (returning): return
|
||||||
|
if (requestedWireCut):
|
||||||
|
await(defibCutter.CutWire(wireToCut))
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
perm.SetStackInvalidIndicators()
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
perm.SetIndicators(true)
|
||||||
|
perm.SetInteractionPermissions(true)
|
||||||
|
|
||||||
|
func OutOfHealth(who : String):
|
||||||
|
if (who == "player"):
|
||||||
|
death.MainDeathRoutine()
|
||||||
|
else:
|
||||||
|
await get_tree().create_timer(1, false).timeout
|
||||||
|
EndMainBatch()
|
||||||
|
|
||||||
|
func EndMainBatch():
|
||||||
|
#ADD TO BATCH INDEX
|
||||||
|
ignoring = true
|
||||||
|
playerData.currentBatchIndex += 1
|
||||||
|
#PLAY WINNING SHIT
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
if (playerData.currentBatchIndex == 3):
|
||||||
|
healthCounter.speaker_truedeath.stop()
|
||||||
|
healthCounter.DisableCounter()
|
||||||
|
defibCutter.BlipError_Both()
|
||||||
|
await get_tree().create_timer(.4, false).timeout
|
||||||
|
#gameover.PlayerWon()
|
||||||
|
camera.BeginLerp("enemy")
|
||||||
|
await get_tree().create_timer(.7, false).timeout
|
||||||
|
brief.MainRoutine()
|
||||||
|
return
|
||||||
|
healthCounter.DisableCounter()
|
||||||
|
speaker_roundShutDown.play()
|
||||||
|
await get_tree().create_timer(1, false).timeout
|
||||||
|
speaker_winner.play()
|
||||||
|
ui_winner.visible = true
|
||||||
|
itemManager.newBatchHasBegun = true
|
||||||
|
await get_tree().create_timer(2.33, false).timeout
|
||||||
|
speaker_roundShutDown.play()
|
||||||
|
speaker_winner.stop()
|
||||||
|
musicManager.EndTrack()
|
||||||
|
ui_winner.visible = false
|
||||||
|
#REGROW BARREL IF MISSING
|
||||||
|
if (barrelSawedOff):
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
await(segmentManager.GrowBarrel())
|
||||||
|
#MAIN BATCH LOOP
|
||||||
|
MainBatchSetup(false)
|
||||||
|
if (!dealerAtTable):
|
||||||
|
if (!dealerCuffed): animator_dealerHands.play("dealer hands on table")
|
||||||
|
else: animator_dealerHands.play("dealer hands on table cuffed")
|
||||||
|
animator_dealer.play("dealer return to table")
|
||||||
|
for i in range(ejectManagers.size()):
|
||||||
|
ejectManagers[i].FadeOutShell()
|
||||||
|
#TRACK MANAGER
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
musicManager.LoadTrack_FadeIn()
|
98
SaveFileManager.gd
Normal file
98
SaveFileManager.gd
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
class_name SaveFileManager extends Node
|
||||||
|
|
||||||
|
const savePath := "user://buckshotroulette.save"
|
||||||
|
var data = {}
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var isMainMenu : bool
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
if (!isMainMenu): LoadGame()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func SaveGame():
|
||||||
|
data = {
|
||||||
|
"has_read_introduction": roundManager.playerData.hasReadIntroduction,
|
||||||
|
"has_read_item_swap_introduction": roundManager.playerData.hasReadItemSwapIntroduction,
|
||||||
|
"has_read_item_distribution_intro": roundManager.playerData.hasReadItemDistributionIntro,
|
||||||
|
"current_batch_index": roundManager.playerData.currentBatchIndex,
|
||||||
|
"player_entering_from_death": roundManager.playerData.playerEnteringFromDeath,
|
||||||
|
"test_value": roundManager.playerData.testValue,
|
||||||
|
"has_read_item_distribution_intro_2": roundManager.playerData.hasReadItemDistributionIntro2,
|
||||||
|
"number_of_dialogue_read": roundManager.playerData.numberOfDialogueRead,
|
||||||
|
"skipping_shell_description": roundManager.playerData.skippingShellDescription,
|
||||||
|
"indicator_shown": roundManager.playerData.indicatorShown,
|
||||||
|
"cutter_dialogue_read": roundManager.playerData.cutterDialogueRead,
|
||||||
|
"entering_from_true_death": roundManager.playerData.enteringFromTrueDeath,
|
||||||
|
"has_signed_waiver": roundManager.playerData.hasSignedWaiver,
|
||||||
|
"seen_hint": roundManager.playerData.seenHint,
|
||||||
|
"seen_god": roundManager.playerData.seenGod,
|
||||||
|
"player_name": roundManager.playerData.playername,
|
||||||
|
|
||||||
|
"stat_shotsFired": roundManager.playerData.stat_shotsFired,
|
||||||
|
"stat_shellsEjected": roundManager.playerData.stat_shellsEjected,
|
||||||
|
"stat_doorsKicked": roundManager.playerData.stat_doorsKicked,
|
||||||
|
"stat_cigSmoked": roundManager.playerData.stat_cigSmoked,
|
||||||
|
"stat_beerDrank": roundManager.playerData.stat_beerDrank
|
||||||
|
}
|
||||||
|
var file = FileAccess.open(savePath, FileAccess.WRITE)
|
||||||
|
file.store_var(data)
|
||||||
|
#file.store_var(roundManager.playerData.hasReadIntroduction)
|
||||||
|
#file.store_var(roundManager.playerData.hasReadItemSwapIntroduction)
|
||||||
|
#file.store_var(roundManager.playerData.hasReadItemDistributionIntro)
|
||||||
|
#file.store_var(roundManager.playerData.currentBatchIndex)
|
||||||
|
#file.store_var(roundManager.playerData.playerEnteringFromDeath)
|
||||||
|
#file.store_var(roundManager.playerData.testValue)
|
||||||
|
#file.store_var(roundManager.playerData.hasReadItemDistributionIntro2)
|
||||||
|
#file.store_var(roundManager.playerData.numberOfDialogueRead)
|
||||||
|
#file.store_var(roundManager.playerData.skippingShellDescription)
|
||||||
|
#file.store_var(roundManager.playerData.indicatorShown)
|
||||||
|
#file.store_var(roundManager.playerData.cutterDialogueRead)
|
||||||
|
#file.store_var(roundManager.playerData.enteringFromTrueDeath)
|
||||||
|
#file.store_var(roundManager.playerData.hasSignedWaiver)
|
||||||
|
#file.store_string(roundManager.playerData.playername)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
func LoadGame():
|
||||||
|
if (FileAccess.file_exists(savePath)):
|
||||||
|
var file = FileAccess.open(savePath, FileAccess.READ)
|
||||||
|
data = file.get_var()
|
||||||
|
roundManager.playerData.hasReadIntroduction = data.has_read_introduction
|
||||||
|
roundManager.playerData.hasReadItemSwapIntroduction = data.has_read_item_swap_introduction
|
||||||
|
roundManager.playerData.hasReadItemDistributionIntro = data.has_read_item_distribution_intro
|
||||||
|
roundManager.playerData.currentBatchIndex = data.current_batch_index
|
||||||
|
roundManager.playerData.playerEnteringFromDeath = data.player_entering_from_death
|
||||||
|
roundManager.playerData.testValue = data.test_value
|
||||||
|
roundManager.playerData.hasReadItemDistributionIntro2 = data.has_read_item_distribution_intro_2
|
||||||
|
roundManager.playerData.numberOfDialogueRead = data.number_of_dialogue_read
|
||||||
|
roundManager.playerData.skippingShellDescription = data.skipping_shell_description
|
||||||
|
roundManager.playerData.indicatorShown = data.indicator_shown
|
||||||
|
roundManager.playerData.cutterDialogueRead = data.cutter_dialogue_read
|
||||||
|
roundManager.playerData.enteringFromTrueDeath = data.entering_from_true_death
|
||||||
|
roundManager.playerData.hasSignedWaiver = data.has_signed_waiver
|
||||||
|
roundManager.playerData.playername = data.player_name
|
||||||
|
roundManager.playerData.seenHint = data.seen_hint
|
||||||
|
roundManager.playerData.seenGod = data.seen_god
|
||||||
|
|
||||||
|
roundManager.playerData.stat_shotsFired = data.stat_shotsFired
|
||||||
|
roundManager.playerData.stat_shellsEjected = data.stat_shellsEjected
|
||||||
|
roundManager.playerData.stat_doorsKicked = data.stat_doorsKicked
|
||||||
|
roundManager.playerData.stat_cigSmoked = data.stat_cigSmoked
|
||||||
|
roundManager.playerData.stat_beerDrank = data.stat_beerDrank
|
||||||
|
#roundManager.playerData.hasReadIntroduction = file.get_var(roundManager.playerData.hasReadIntroduction)
|
||||||
|
#roundManager.playerData.hasReadItemSwapIntroduction = file.get_var(roundManager.playerData.hasReadItemSwapIntroduction)
|
||||||
|
#roundManager.playerData.hasReadItemDistributionIntro = file.get_var(roundManager.playerData.hasReadItemDistributionIntro)
|
||||||
|
#roundManager.playerData.currentBatchIndex = file.get_var(roundManager.playerData.currentBatchIndex)
|
||||||
|
#roundManager.playerData.playerEnteringFromDeath = file.get_var(roundManager.playerData.playerEnteringFromDeath)
|
||||||
|
#roundManager.playerData.testValue = file.get_var(roundManager.playerData.testValue)
|
||||||
|
#roundManager.playerData.hasReadItemDistributionIntro2 = file.get_var(roundManager.playerData.testValue)
|
||||||
|
#roundManager.playerData.numberOfDialogueRead = file.get_var(roundManager.playerData.numberOfDialogueRead)
|
||||||
|
#roundManager.playerData.skippingShellDescription = file.get_var(roundManager.playerData.skippingShellDescription)
|
||||||
|
#roundManager.playerData.indicatorShown = file.get_var(roundManager.playerData.indicatorShown)
|
||||||
|
#roundManager.playerData.cutterDialogueRead = file.get_var(roundManager.playerData.cutterDialogueRead)
|
||||||
|
#roundManager.playerData.enteringFromTrueDeath = file.get_var(roundManager.playerData.enteringFromTrueDeath)
|
||||||
|
#roundManager.playerData.hasSignedWaiver = file.get_var(roundManager.playerData.hasSignedWaiver)
|
||||||
|
#roundManager.playerData.playername = file.get_as_text(roundManager.playerData.playername)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
func ClearSave():
|
||||||
|
if (FileAccess.file_exists(savePath)): DirAccess.remove_absolute(savePath)
|
40
SegmentManager.gd
Normal file
40
SegmentManager.gd
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
class_name SegmentManager extends Node
|
||||||
|
|
||||||
|
@export var speaker : AudioStreamPlayer2D
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var mat : StandardMaterial3D
|
||||||
|
var dur = 2
|
||||||
|
var elapsed = 0
|
||||||
|
var moving = false
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
LerpSegment()
|
||||||
|
|
||||||
|
func GrowBarrel():
|
||||||
|
var prevsocket = camera.activeSocket
|
||||||
|
roundManager.currentShotgunDamage = 1
|
||||||
|
roundManager.barrelSawedOff = false
|
||||||
|
camera.BeginLerp("grow barrel")
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
ShowSegment()
|
||||||
|
speaker.play()
|
||||||
|
await get_tree().create_timer(1.8, false).timeout
|
||||||
|
camera.BeginLerp(prevsocket)
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
pass
|
||||||
|
|
||||||
|
func HideSegment():
|
||||||
|
moving = false
|
||||||
|
mat.albedo_color = Color(1, 1, 1, 0)
|
||||||
|
|
||||||
|
func ShowSegment():
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func LerpSegment():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / dur, 0.0, 1.0)
|
||||||
|
var alpha = lerp(0, 1, c)
|
||||||
|
mat.albedo_color = Color(1, 1, 1, alpha)
|
19
ShellBranch.gd
Normal file
19
ShellBranch.gd
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
class_name ShellClass extends Node
|
||||||
|
|
||||||
|
@export var isLive : bool
|
||||||
|
@export var mat_live : StandardMaterial3D
|
||||||
|
@export var mat_blank : StandardMaterial3D
|
||||||
|
@export var mesh : MeshInstance3D
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func ApplyStatus():
|
||||||
|
if (isLive):
|
||||||
|
mesh.set_surface_override_material(1, mat_live)
|
||||||
|
else:
|
||||||
|
mesh.set_surface_override_material(1, mat_blank)
|
||||||
|
pass
|
9
ShellDropManager.gd
Normal file
9
ShellDropManager.gd
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
class_name ShellDropManager extends Node
|
||||||
|
|
||||||
|
@export var speaker : AudioStreamPlayer2D
|
||||||
|
@export var soundArray : Array[AudioStream]
|
||||||
|
|
||||||
|
func PlayShellDropSound():
|
||||||
|
var randindex = randi_range(0, soundArray.size() - 1)
|
||||||
|
speaker.stream = soundArray[randindex]
|
||||||
|
speaker.play()
|
70
ShellEjectManager.gd
Normal file
70
ShellEjectManager.gd
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
class_name ShellEjectManager extends Node
|
||||||
|
|
||||||
|
@export var mesh : MeshInstance3D
|
||||||
|
@export var shellSpawner : ShellSpawner
|
||||||
|
@export var mat_blank : StandardMaterial3D
|
||||||
|
@export var mat_live : StandardMaterial3D
|
||||||
|
@export var mat_brass : StandardMaterial3D
|
||||||
|
@export var animator : AnimationPlayer
|
||||||
|
@export var animator_fader : AnimationPlayer
|
||||||
|
@export var isDealerSide : bool
|
||||||
|
@export var smoke : SmokeController
|
||||||
|
|
||||||
|
var hasFaded = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
mesh.set_surface_override_material(0, mat_brass)
|
||||||
|
|
||||||
|
func EjectShell():
|
||||||
|
shellSpawner.roundManager.playerData.stat_shellsEjected += 1
|
||||||
|
animator_fader.play("RESET")
|
||||||
|
if (shellSpawner.sequenceArray[0] == "live"): mesh.set_surface_override_material(1, mat_live)
|
||||||
|
else: mesh.set_surface_override_material(1, mat_blank)
|
||||||
|
mesh.visible = true
|
||||||
|
if(!isDealerSide): animator.play("ejecting shell_player1")
|
||||||
|
else: animator.play("eject shell")
|
||||||
|
if (shellSpawner.sequenceArray[0] == "live"):
|
||||||
|
smoke.SpawnSmoke("chamber")
|
||||||
|
shellSpawner.sequenceArray.remove_at(0)
|
||||||
|
hasFaded = false
|
||||||
|
pass
|
||||||
|
|
||||||
|
func BeerEjection_player():
|
||||||
|
shellSpawner.roundManager.playerData.stat_shellsEjected += 1
|
||||||
|
animator_fader.play("RESET")
|
||||||
|
if (shellSpawner.sequenceArray[0] == "live"): mesh.set_surface_override_material(1, mat_live)
|
||||||
|
else: mesh.set_surface_override_material(1, mat_blank)
|
||||||
|
mesh.visible = true
|
||||||
|
animator.play("ejecting shell_player1")
|
||||||
|
shellSpawner.sequenceArray.remove_at(0)
|
||||||
|
hasFaded = false
|
||||||
|
pass
|
||||||
|
|
||||||
|
func BeerEjection_dealer():
|
||||||
|
shellSpawner.roundManager.playerData.stat_shellsEjected += 1
|
||||||
|
animator_fader.play("RESET")
|
||||||
|
if (shellSpawner.sequenceArray[0] == "live"): mesh.set_surface_override_material(1, mat_live)
|
||||||
|
else: mesh.set_surface_override_material(1, mat_blank)
|
||||||
|
mesh.visible = true
|
||||||
|
animator.play("eject shell beer")
|
||||||
|
shellSpawner.sequenceArray.remove_at(0)
|
||||||
|
hasFaded = false
|
||||||
|
pass
|
||||||
|
|
||||||
|
func DeathEjection():
|
||||||
|
animator_fader.play("RESET")
|
||||||
|
if (shellSpawner.sequenceArray[0] == "live"): mesh.set_surface_override_material(1, mat_live)
|
||||||
|
else: mesh.set_surface_override_material(1, mat_blank)
|
||||||
|
mesh.visible = true
|
||||||
|
if(!isDealerSide): animator.play("ejecting shell_player1")
|
||||||
|
else: animator.play("eject shell")
|
||||||
|
if (shellSpawner.sequenceArray[0] == "live"):
|
||||||
|
smoke.SpawnSmoke("chamber")
|
||||||
|
shellSpawner.sequenceArray.remove_at(0)
|
||||||
|
hasFaded = false
|
||||||
|
pass
|
||||||
|
|
||||||
|
func FadeOutShell():
|
||||||
|
if(!hasFaded):
|
||||||
|
animator_fader.play("fade out shell")
|
||||||
|
hasFaded = true
|
24
ShellExamine.gd
Normal file
24
ShellExamine.gd
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
class_name ShellExamine extends Node
|
||||||
|
|
||||||
|
@export var shellSpawner : ShellSpawner
|
||||||
|
@export var shellParent : Node3D
|
||||||
|
@export var mesh : MeshInstance3D
|
||||||
|
@export var mat : StandardMaterial3D
|
||||||
|
@export var mat_blank : StandardMaterial3D
|
||||||
|
@export var mat_live : StandardMaterial3D
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
shellParent.visible = false
|
||||||
|
|
||||||
|
func SetupShell():
|
||||||
|
var color_blue = Color(0, 0, 1)
|
||||||
|
var color_red = Color(1, 0, 0)
|
||||||
|
var shellState = shellSpawner.sequenceArray[0]
|
||||||
|
if (shellState == "live"):
|
||||||
|
mesh.set_surface_override_material(1, mat_live)
|
||||||
|
else:
|
||||||
|
mesh.set_surface_override_material(1, mat_blank)
|
||||||
|
shellParent.visible = true
|
||||||
|
|
||||||
|
func RevertShell():
|
||||||
|
shellParent.visible = false
|
94
ShellLoader.gd
Normal file
94
ShellLoader.gd
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
class_name ShellLoader extends Node
|
||||||
|
|
||||||
|
@export var perm : PermissionManager
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var speaker_loadShell : AudioStreamPlayer2D
|
||||||
|
@export var speaker_rackShotgun : AudioStreamPlayer2D
|
||||||
|
@export var animator_shotgun : AnimationPlayer
|
||||||
|
@export var dialogue : Dialogue
|
||||||
|
@export var cursor : CursorManager
|
||||||
|
@export var playerData : PlayerData
|
||||||
|
@export var shotgunHand_L : Node3D
|
||||||
|
@export var shotgunHand_R : Node3D
|
||||||
|
@export var animator_dealerHands : AnimationPlayer
|
||||||
|
@export var animator_dealerHandRight : AnimationPlayer
|
||||||
|
@export var dealerAI : DealerIntelligence
|
||||||
|
@export_multiline var introductionDialogues : Array[String]
|
||||||
|
@export_multiline var loadingDialogues : Array[String]
|
||||||
|
var diaindex = 0
|
||||||
|
|
||||||
|
func DealerHandsGrabShotgun():
|
||||||
|
animator_dealerHands.play("dealer grab shotgun")
|
||||||
|
await get_tree().create_timer(.45, false).timeout
|
||||||
|
dealerAI.Speaker_HandCrack()
|
||||||
|
shotgunHand_L.visible = true
|
||||||
|
shotgunHand_R.visible = true
|
||||||
|
|
||||||
|
func DealerHandsDropShotgun():
|
||||||
|
shotgunHand_L.visible = false
|
||||||
|
shotgunHand_R.visible = false
|
||||||
|
animator_dealerHands.play("RESET")
|
||||||
|
pass
|
||||||
|
|
||||||
|
func LoadShells():
|
||||||
|
camera.BeginLerp("enemy")
|
||||||
|
if (!roundManager.shellLoadingSpedUp): await get_tree().create_timer(.8, false).timeout
|
||||||
|
await(DealerHandsGrabShotgun())
|
||||||
|
await get_tree().create_timer(.2, false).timeout
|
||||||
|
animator_shotgun.play("grab shotgun_pointing enemy")
|
||||||
|
await get_tree().create_timer(.45, false).timeout
|
||||||
|
if (roundManager.playerData.numberOfDialogueRead < 3):
|
||||||
|
if (diaindex == loadingDialogues.size()):
|
||||||
|
diaindex = 0
|
||||||
|
dialogue.ShowText_ForDuration(loadingDialogues[diaindex], 3)
|
||||||
|
diaindex += 1
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
roundManager.playerData.numberOfDialogueRead += 1
|
||||||
|
var numberOfShells = roundManager.roundArray[roundManager.currentRound].amountBlank + roundManager.roundArray[roundManager.currentRound].amountLive
|
||||||
|
for i in range(numberOfShells):
|
||||||
|
speaker_loadShell.play()
|
||||||
|
animator_dealerHandRight.play("load single shell")
|
||||||
|
if(roundManager.shellLoadingSpedUp): await get_tree().create_timer(.17, false).timeout
|
||||||
|
else: await get_tree().create_timer(.32, false).timeout
|
||||||
|
pass
|
||||||
|
animator_dealerHandRight.play("RESET")
|
||||||
|
dealerAI.Speaker_HandCrack()
|
||||||
|
if (roundManager.shellLoadingSpedUp): await get_tree().create_timer(.17, false).timeout
|
||||||
|
else: await get_tree().create_timer(.42, false).timeout
|
||||||
|
#INTRODUCTION DIALOGUE
|
||||||
|
if (roundManager.roundArray[roundManager.currentRound].hasIntroductoryText):
|
||||||
|
dialogue.ShowText_Forever(introductionDialogues[0])
|
||||||
|
await get_tree().create_timer(1.9, false).timeout
|
||||||
|
dialogue.ShowText_Forever(introductionDialogues[1])
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
dialogue.ShowText_Forever(introductionDialogues[2])
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
dialogue.ShowText_Forever(introductionDialogues[3])
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
dialogue.ShowText_Forever(introductionDialogues[4])
|
||||||
|
await get_tree().create_timer(3, false).timeout
|
||||||
|
dialogue.ShowText_Forever(introductionDialogues[5])
|
||||||
|
await get_tree().create_timer(3.7, false).timeout
|
||||||
|
dialogue.ShowText_Forever(introductionDialogues[6])
|
||||||
|
await get_tree().create_timer(3.7, false).timeout
|
||||||
|
dialogue.ShowText_Forever(introductionDialogues[7])
|
||||||
|
await get_tree().create_timer(3.7, false).timeout
|
||||||
|
dialogue.ShowText_Forever(introductionDialogues[8])
|
||||||
|
await get_tree().create_timer(2.5, false).timeout
|
||||||
|
roundManager.playerData.hasReadIntroduction = true
|
||||||
|
dialogue.HideText()
|
||||||
|
#RACK SHOTGUN, PLACE ON TABLE
|
||||||
|
#speaker_rackShotgun.play()
|
||||||
|
animator_shotgun.play("enemy rack shotgun start")
|
||||||
|
await get_tree().create_timer(.8, false).timeout
|
||||||
|
animator_shotgun.play("enemy put down shotgun")
|
||||||
|
DealerHandsDropShotgun()
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
#ALLOW INTERACTION
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
perm.SetStackInvalidIndicators()
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
perm.SetIndicators(true)
|
||||||
|
perm.SetInteractionPermissions(true)
|
||||||
|
pass
|
155
ShellSpawner.gd
Normal file
155
ShellSpawner.gd
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
class_name ShellSpawner extends Node
|
||||||
|
|
||||||
|
@export var dialogue : Dialogue
|
||||||
|
@export var anim_compartment : AnimationPlayer
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var shellInstance : PackedScene
|
||||||
|
@export var shellLocationArray : Array[Vector3]
|
||||||
|
@export var spawnParent : Node3D
|
||||||
|
@export var healthCounter : HealthCounter
|
||||||
|
@export var soundArray_latchOpen : Array[AudioStream]
|
||||||
|
@export var speaker_latchOpen : AudioStreamPlayer2D
|
||||||
|
@export var speaker_audioIndicator : AudioStreamPlayer2D
|
||||||
|
@export var soundArray_indicators : Array[AudioStream]
|
||||||
|
|
||||||
|
var spawnedShell
|
||||||
|
var locationIndex
|
||||||
|
var tempSequence : Array[String]
|
||||||
|
var sequenceArray : Array[String]
|
||||||
|
var shellBranch : ShellClass
|
||||||
|
var spawnedShellObjectArray = []
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
var skipDialoguePresented = false
|
||||||
|
func MainShellRoutine():
|
||||||
|
if (roundManager.playerData.currentBatchIndex != 0):
|
||||||
|
roundManager.shellLoadingSpedUp = true
|
||||||
|
#CLEAR PREVIOUS SHELL SEQUENCE ARRAY
|
||||||
|
sequenceArray = []
|
||||||
|
#CHECK IF CONSOLE TEXT EXISTS. SHOW CONSOLE TEXT
|
||||||
|
|
||||||
|
#INITIAL CAMERA SOCKET. HEALTH COUNTER FUNCTIONALITY
|
||||||
|
if (roundManager.roundArray[roundManager.currentRound].bootingUpCounter):
|
||||||
|
camera.BeginLerp("health counter")
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
healthCounter.Bootup()
|
||||||
|
await get_tree().create_timer(1.4, false).timeout
|
||||||
|
#await get_tree().create_timer(2, false).timeout #NEW
|
||||||
|
camera.BeginLerp("shell compartment")
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
#SHELL SPAWNING
|
||||||
|
var temp_nr = roundManager.roundArray[roundManager.currentRound].amountBlank + roundManager.roundArray[roundManager.currentRound].amountLive
|
||||||
|
var temp_live = roundManager.roundArray[roundManager.currentRound].amountLive
|
||||||
|
var temp_blank = roundManager.roundArray[roundManager.currentRound].amountBlank
|
||||||
|
var temp_shuf = roundManager.roundArray[roundManager.currentRound].shufflingArray
|
||||||
|
SpawnShells(temp_nr, temp_live, temp_blank, temp_shuf)
|
||||||
|
seq = sequenceArray
|
||||||
|
anim_compartment.play("show shells")
|
||||||
|
PlayLatchSound()
|
||||||
|
PlayAudioIndicators()
|
||||||
|
await get_tree().create_timer(1, false).timeout
|
||||||
|
roundManager.ignoring = false
|
||||||
|
#DIALOGUE
|
||||||
|
var text_lives
|
||||||
|
var text_blanks
|
||||||
|
if (temp_live == 1): text_lives = "LIVE ROUND."
|
||||||
|
else: text_lives = "LIVE ROUNDS."
|
||||||
|
if (temp_blank == 1): text_blanks = "BLANK."
|
||||||
|
else: text_blanks = "BLANKS."
|
||||||
|
var finalstring : String = str(temp_live) + " " + text_lives + " " + str(temp_blank) + " " + text_blanks
|
||||||
|
var maindur = 1.3
|
||||||
|
if (roundManager.playerData.currentBatchIndex == 2):
|
||||||
|
roundManager.playerData.skippingShellDescription = true
|
||||||
|
if (!roundManager.playerData.skippingShellDescription): dialogue.ShowText_Forever(finalstring)
|
||||||
|
if (roundManager.playerData.skippingShellDescription && !skipDialoguePresented):
|
||||||
|
dialogue.ShowText_Forever("YOU KNOW THE DRILL.")
|
||||||
|
maindur = 2.5
|
||||||
|
skipDialoguePresented = true
|
||||||
|
if(!roundManager.playerData.skippingShellDescription): await get_tree().create_timer(2.5, false).timeout
|
||||||
|
else: await get_tree().create_timer(maindur, false).timeout
|
||||||
|
dialogue.HideText()
|
||||||
|
#HIDE SHELLS
|
||||||
|
anim_compartment.play("hide shells")
|
||||||
|
PlayLatchSound()
|
||||||
|
if(roundManager.shellLoadingSpedUp): await get_tree().create_timer(.2, false).timeout
|
||||||
|
else: await get_tree().create_timer(.5, false).timeout
|
||||||
|
#CHECK IF INSERTING INTO CHAMBER IN RANDOM ORDER.
|
||||||
|
if (roundManager.roundArray[roundManager.currentRound].insertingInRandomOrder):
|
||||||
|
sequenceArray.shuffle()
|
||||||
|
sequenceArray.shuffle()
|
||||||
|
roundManager.LoadShells()
|
||||||
|
return
|
||||||
|
pass
|
||||||
|
|
||||||
|
func SpawnShells(numberOfShells : int, numberOfLives : int, numberOfBlanks : int, shufflingArray : bool):
|
||||||
|
#DELETE PREVIOUS SHELLS
|
||||||
|
for i in range(spawnedShellObjectArray.size()):
|
||||||
|
spawnedShellObjectArray[i].queue_free()
|
||||||
|
spawnedShellObjectArray = []
|
||||||
|
|
||||||
|
#SETUP SHELL ARRAY
|
||||||
|
sequenceArray = []
|
||||||
|
tempSequence = []
|
||||||
|
for i in range(numberOfLives):
|
||||||
|
tempSequence.append("live")
|
||||||
|
for i in range(numberOfBlanks):
|
||||||
|
tempSequence.append("blank")
|
||||||
|
if (shufflingArray):
|
||||||
|
tempSequence.shuffle()
|
||||||
|
for i in range(tempSequence.size()):
|
||||||
|
sequenceArray.append(tempSequence[i])
|
||||||
|
pass
|
||||||
|
|
||||||
|
locationIndex = 0
|
||||||
|
#SPAWN SHELLS
|
||||||
|
for i in range(numberOfShells):
|
||||||
|
spawnedShell = shellInstance.instantiate()
|
||||||
|
shellBranch = spawnedShell.get_child(0)
|
||||||
|
if (sequenceArray[i] == "live"): shellBranch.isLive = true
|
||||||
|
else: shellBranch.isLive = false
|
||||||
|
shellBranch.ApplyStatus()
|
||||||
|
spawnParent.add_child(spawnedShell)
|
||||||
|
spawnedShell.transform.origin = shellLocationArray[locationIndex]
|
||||||
|
spawnedShell.rotation_degrees = Vector3(-90, -90, 180)
|
||||||
|
spawnedShellObjectArray.append(spawnedShell)
|
||||||
|
locationIndex += 1
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
|
||||||
|
var tog = false
|
||||||
|
func PlayLatchSound():
|
||||||
|
tog = !tog
|
||||||
|
if (tog): speaker_latchOpen.stream = soundArray_latchOpen[0]
|
||||||
|
else: speaker_latchOpen.stream = soundArray_latchOpen[1]
|
||||||
|
speaker_latchOpen.play()
|
||||||
|
|
||||||
|
var seq = []
|
||||||
|
func PlayAudioIndicators():
|
||||||
|
await get_tree().create_timer(.37, false).timeout
|
||||||
|
for i in range(seq.size()):
|
||||||
|
if (seq[i] == "blank"): speaker_audioIndicator.stream = soundArray_indicators[0]
|
||||||
|
else: speaker_audioIndicator.stream = soundArray_indicators[1]
|
||||||
|
speaker_audioIndicator.play()
|
||||||
|
await get_tree().create_timer(.07, false).timeout
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
214
ShotgunShooting.gd
Normal file
214
ShotgunShooting.gd
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
class_name ShotgunShooting extends Node
|
||||||
|
|
||||||
|
@export var ejectionManager_player : ShellEjectManager
|
||||||
|
@export var cursorManager : CursorManager
|
||||||
|
@export var shotgunIndicator : PickupIndicator
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var shellSpawner : ShellSpawner
|
||||||
|
@export var collider_shotgun : StaticBody3D
|
||||||
|
@export var decisionText : DecisionTextManager
|
||||||
|
@export var shotgunshaker : ObjectShaker
|
||||||
|
@export var perm : PermissionManager
|
||||||
|
@export var animator_shotgun : AnimationPlayer
|
||||||
|
@export var camera : CameraManager
|
||||||
|
@export var speaker_live : AudioStreamPlayer2D
|
||||||
|
@export var speaker_blank : AudioStreamPlayer2D
|
||||||
|
@export var healthCounter : HealthCounter
|
||||||
|
@export var animator_muzzleFlash : AnimationPlayer
|
||||||
|
@export var animator_muzzleFlash_model : AnimationPlayer
|
||||||
|
@export var cameraShaker : CameraShaker
|
||||||
|
@export var death : DeathManager
|
||||||
|
@export var smoke : SmokeController
|
||||||
|
@export var speakerArray_pitchShift : Array[SpeakerController]
|
||||||
|
@export var speakerArray_pitchShift3D : Array[SpeakerController3D]
|
||||||
|
@export var timescale : TimeScaleManager
|
||||||
|
@export var splatters : Array[CompressedTexture2D]
|
||||||
|
@export var mat_splatter : GeometryInstance3D
|
||||||
|
@export var speaker_splatter : AudioStreamPlayer2D
|
||||||
|
@export var anim_splatter : AnimationPlayer
|
||||||
|
|
||||||
|
var playerCanGoAgain
|
||||||
|
|
||||||
|
func GrabShotgun():
|
||||||
|
perm.SetIndicators(false)
|
||||||
|
perm.SetInteractionPermissions(false)
|
||||||
|
perm.RevertDescriptionUI()
|
||||||
|
ShotgunCollider(false)
|
||||||
|
animator_shotgun.play("player grab shotgun")
|
||||||
|
shotgunshaker.StartShaking()
|
||||||
|
decisionText.SetUI(true)
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
|
||||||
|
var disablingDelayShit = false
|
||||||
|
var dealerShotTrue = false
|
||||||
|
|
||||||
|
func MainSlowDownRoutine(whoCopy : String, fromDealer : bool):
|
||||||
|
var who = whoCopy
|
||||||
|
var currentRoundInChamber = shellSpawner.sequenceArray[0]
|
||||||
|
var healthAfterShot = 1
|
||||||
|
if (!fromDealer):
|
||||||
|
healthAfterShot = roundManager.health_opponent - roundManager.currentShotgunDamage
|
||||||
|
if (healthAfterShot < 0): healthAfterShot = 0
|
||||||
|
else: if(roundManager.health_opponent == 0): healthAfterShot = 0
|
||||||
|
if (currentRoundInChamber == "live" && who == "dealer" && healthAfterShot == 0):
|
||||||
|
#TIME SCALE SHIFT
|
||||||
|
for i in range(speakerArray_pitchShift.size()):
|
||||||
|
speakerArray_pitchShift[i].fadeDuration_pitch = timescale.pitchShiftDuration
|
||||||
|
speakerArray_pitchShift[i].BeginPitchShift(speakerArray_pitchShift[i].lowestPitchValue, speakerArray_pitchShift[i].originalPitch)
|
||||||
|
for i in range(speakerArray_pitchShift3D.size()):
|
||||||
|
speakerArray_pitchShift3D[i].fadeDuration_pitch = timescale.pitchShiftDuration
|
||||||
|
speakerArray_pitchShift3D[i].BeginPitchShift(speakerArray_pitchShift3D[i].lowestPitchValue, speakerArray_pitchShift3D[i].originalPitch)
|
||||||
|
timescale.BeginTimeScaleLerp(.2, 1.0)
|
||||||
|
BloodSplatter()
|
||||||
|
|
||||||
|
|
||||||
|
func BloodSplatter():
|
||||||
|
await get_tree().create_timer(.17, false).timeout
|
||||||
|
speaker_splatter.pitch_scale = randf_range(.3, .5)
|
||||||
|
speaker_splatter.play()
|
||||||
|
anim_splatter.play("fade out")
|
||||||
|
mat_splatter.material_override.set("albedo_texture", splatters[0])
|
||||||
|
await get_tree().create_timer(.08, false).timeout
|
||||||
|
mat_splatter.material_override.set("albedo_texture", splatters[1])
|
||||||
|
await get_tree().create_timer(.08, false).timeout
|
||||||
|
mat_splatter.material_override.set("albedo_texture", splatters[2])
|
||||||
|
await get_tree().create_timer(.08, false).timeout
|
||||||
|
mat_splatter.material_override.set("albedo_texture", splatters[3])
|
||||||
|
pass
|
||||||
|
|
||||||
|
func Shoot(who : String):
|
||||||
|
dealerShotTrue = false
|
||||||
|
disablingDelayShit = false
|
||||||
|
playerCanGoAgain = false
|
||||||
|
var playerDied = false
|
||||||
|
var dealerShot = false
|
||||||
|
ejectionManager_player.FadeOutShell()
|
||||||
|
cursorManager.SetCursor(false, false)
|
||||||
|
#CAMERA CONTROLS & ANIMATION DEPENDING ON WHO IS SHOT
|
||||||
|
match(who):
|
||||||
|
"self":
|
||||||
|
await get_tree().create_timer(.25, false).timeout
|
||||||
|
animator_shotgun.play("player shoot self")
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
camera.BeginLerp("enemy")
|
||||||
|
"dealer":
|
||||||
|
await get_tree().create_timer(.25, false).timeout
|
||||||
|
animator_shotgun.play("player shoot dealer")
|
||||||
|
await get_tree().create_timer(.5, false).timeout
|
||||||
|
camera.BeginLerp("enemy")
|
||||||
|
#PLAY CORRECT SOUND. ASSIGN CURRENT ROUND IN CHAMBER
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
var currentRoundInChamber = shellSpawner.sequenceArray[0]
|
||||||
|
MainSlowDownRoutine(who, false)
|
||||||
|
if (who == "self"): whoshot = "player"
|
||||||
|
else: whoshot = "dealer"
|
||||||
|
PlayShootingSound()
|
||||||
|
#SHAKE CAMERA
|
||||||
|
if (currentRoundInChamber == "live"):
|
||||||
|
smoke.SpawnSmoke("barrel")
|
||||||
|
cameraShaker.Shake()
|
||||||
|
#SUBTRACT HEALTH. ASSIGN PLAYER CAN GO AGAIN. RETURN IF DEAD
|
||||||
|
if (currentRoundInChamber == "live" && who == "dealer"):
|
||||||
|
roundManager.health_opponent -= roundManager.currentShotgunDamage
|
||||||
|
if (roundManager.health_opponent < 0): roundManager.health_opponent = 0
|
||||||
|
if (currentRoundInChamber == "live" && who == "self"):
|
||||||
|
roundManager.waitingForHealthCheck2 = true
|
||||||
|
if (shellSpawner.sequenceArray.size() == 1):
|
||||||
|
whatTheFuck = true
|
||||||
|
roundManager.waitingForDealerReturn = true
|
||||||
|
healthCounter.playerShotSelf = true
|
||||||
|
playerDied = true
|
||||||
|
roundManager.health_player -= roundManager.currentShotgunDamage
|
||||||
|
if (roundManager.health_player < 0): roundManager.health_player = 0
|
||||||
|
playerCanGoAgain = false
|
||||||
|
healthCounter.checkingPlayer = true
|
||||||
|
await(death.Kill("player", false, true))
|
||||||
|
if (currentRoundInChamber == "blank" && who == "self"): playerCanGoAgain = true
|
||||||
|
if (currentRoundInChamber == "live" && who == "dealer"):
|
||||||
|
playerCanGoAgain = false
|
||||||
|
dealerShot = true
|
||||||
|
dealerShotTrue = true
|
||||||
|
await(death.Kill("dealer", false, false))
|
||||||
|
if (playerDied): return
|
||||||
|
if (dealerShot): return
|
||||||
|
await get_tree().create_timer(.3, false).timeout
|
||||||
|
#EJECTING SHELLS
|
||||||
|
if (currentRoundInChamber == "blank" && who == "self"):
|
||||||
|
animator_shotgun.play("player eject shell")
|
||||||
|
await get_tree().create_timer(.85, false).timeout
|
||||||
|
camera.BeginLerp("home")
|
||||||
|
await get_tree().create_timer(1.35, false).timeout
|
||||||
|
FinalizeShooting(playerCanGoAgain, true, false, false)
|
||||||
|
return
|
||||||
|
if (currentRoundInChamber == "blank" && who == "dealer"): disablingDelayShit = true
|
||||||
|
ShootingDealerEjection(currentRoundInChamber, who, false)
|
||||||
|
|
||||||
|
func ShootingDealerEjection(currentRoundInChamberCopy : String, whoCopy : String, hasDelay : bool):
|
||||||
|
if ((currentRoundInChamberCopy == "blank" or currentRoundInChamberCopy == "live") && whoCopy == "dealer"):
|
||||||
|
animator_shotgun.play("player eject shell2")
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
if (hasDelay): await get_tree().create_timer(2.5, false).timeout
|
||||||
|
if (!disablingDelayShit):
|
||||||
|
FinalizeShooting(playerCanGoAgain, true, true, false)
|
||||||
|
else:
|
||||||
|
FinalizeShooting(playerCanGoAgain, true, false, false)
|
||||||
|
|
||||||
|
var whatTheFuck = false
|
||||||
|
var delaying = false
|
||||||
|
var isPlayerSide = false
|
||||||
|
func FinalizeShooting(playerCanGoAgain : bool, placeShotgunOnTable : bool, waitForRevival : bool, addDelay : bool):
|
||||||
|
if(placeShotgunOnTable): animator_shotgun.play("player place on table after eject")
|
||||||
|
shotgunshaker.StopShaking()
|
||||||
|
#shellSpawner.sequenceArray.remove_at(0)
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
shotgunIndicator.Revert()
|
||||||
|
ShotgunCollider(true)
|
||||||
|
if (death.shitIsFuckedUp): await get_tree().create_timer(3, false).timeout
|
||||||
|
if (waitForRevival): await get_tree().create_timer(2, false).timeout
|
||||||
|
if (addDelay): await get_tree().create_timer(3, false).timeout
|
||||||
|
if (delaying): await get_tree().create_timer(4, false).timeout
|
||||||
|
if (whatTheFuck): await get_tree().create_timer(2, false).timeout
|
||||||
|
whatTheFuck = false
|
||||||
|
#delaying = false
|
||||||
|
if (roundManager.shellSpawner.sequenceArray.size() == 0 && dealerShotTrue): await get_tree().create_timer(2, false).timeout
|
||||||
|
#abc
|
||||||
|
if ((roundManager.health_opponent <= 2 or roundManager.health_player <= 2) && roundManager.playerData.currentBatchIndex == 2):
|
||||||
|
if (roundManager.health_opponent <= 2 && !roundManager.wireIsCut_dealer):
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
if (roundManager.health_player <= 2 && !roundManager.wireIsCut_player):
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
if(roundManager.health_opponent != 0): roundManager.EndTurn(playerCanGoAgain)
|
||||||
|
|
||||||
|
func PlayShootingSound():
|
||||||
|
var currentRoundInChamber = shellSpawner.sequenceArray[0]
|
||||||
|
if (currentRoundInChamber == "live"):
|
||||||
|
CheckIfFinalShot()
|
||||||
|
speaker_live.play()
|
||||||
|
roundManager.playerData.stat_shotsFired += 1
|
||||||
|
animator_muzzleFlash.play("muzzle flash fire")
|
||||||
|
animator_muzzleFlash_model.play("fire")
|
||||||
|
else: speaker_blank.play()
|
||||||
|
pass
|
||||||
|
|
||||||
|
var fired = false
|
||||||
|
var temphealth_dealer
|
||||||
|
var temphealth_player
|
||||||
|
var whoshot = ""
|
||||||
|
func CheckIfFinalShot():
|
||||||
|
temphealth_dealer = roundManager.health_opponent - roundManager.currentShotgunDamage
|
||||||
|
temphealth_player = roundManager.health_player - roundManager.currentShotgunDamage
|
||||||
|
if (!fired && roundManager.playerData.currentBatchIndex == 2):
|
||||||
|
if (temphealth_player <= 2 && whoshot == "player"):
|
||||||
|
roundManager.musicManager.EndTrack()
|
||||||
|
fired = true
|
||||||
|
if (temphealth_dealer <= 2 && whoshot == "dealer"):
|
||||||
|
roundManager.musicManager.EndTrack()
|
||||||
|
fired = true
|
||||||
|
|
||||||
|
func ShotgunCollider(isEnabled : bool):
|
||||||
|
if (isEnabled):
|
||||||
|
collider_shotgun.collision_layer = 1
|
||||||
|
collider_shotgun.collision_mask = 1
|
||||||
|
else:
|
||||||
|
collider_shotgun.collision_layer = 0
|
||||||
|
collider_shotgun.collision_mask = 0
|
41
SignatureButtonBranch.gd
Normal file
41
SignatureButtonBranch.gd
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
class_name SignButton extends Node
|
||||||
|
|
||||||
|
var parent : Node3D
|
||||||
|
var intbranch : InteractionBranch
|
||||||
|
@export var y_up : float
|
||||||
|
@export var y_down : float
|
||||||
|
@export var dur : float
|
||||||
|
var elapsed = 0
|
||||||
|
var moving = false
|
||||||
|
var cur
|
||||||
|
var next
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
parent = get_parent()
|
||||||
|
intbranch = parent.get_child(1)
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
Lerp()
|
||||||
|
|
||||||
|
func Press():
|
||||||
|
intbranch.interactionAllowed = false
|
||||||
|
cur = y_up
|
||||||
|
next = y_down
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
await get_tree().create_timer(.06, false).timeout
|
||||||
|
moving = false
|
||||||
|
cur = y_down
|
||||||
|
next = y_up
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
await get_tree().create_timer(.06, false).timeout
|
||||||
|
moving = false
|
||||||
|
intbranch.interactionAllowed = true
|
||||||
|
|
||||||
|
func Lerp():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = elapsed / dur
|
||||||
|
var temp_pos = lerpf(cur, next, c)
|
||||||
|
parent.transform.origin = Vector3(parent.transform.origin.x, temp_pos, parent.transform.origin.z)
|
175
SignatureManager.gd
Normal file
175
SignatureManager.gd
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
class_name Signature extends Node
|
||||||
|
|
||||||
|
@export var roundManager : RoundManager
|
||||||
|
@export var parent_shotgun : Node3D
|
||||||
|
@export var parent_waiver : Node3D
|
||||||
|
@export var parent_separateWaiver : Node3D
|
||||||
|
@export var parent_signatureMachineMainParent : Node3D
|
||||||
|
@export var intrbranch_waiver : InteractionBranch
|
||||||
|
@export var cursor : CursorManager
|
||||||
|
@export var anim_waiver : AnimationPlayer
|
||||||
|
@export var intbranches : Array[InteractionBranch]
|
||||||
|
@export var marker : Label3D
|
||||||
|
@export var letterArray : Array[Label3D]
|
||||||
|
@export var ledArray : Array[GeometryInstance3D]
|
||||||
|
@export var posArray_marker : Array[Vector3]
|
||||||
|
@export var letterArray_signature_joined : Array[Label3D]
|
||||||
|
@export var letterArray_signature_separate : Array[Label3D]
|
||||||
|
@export var speaker_bootup : AudioStreamPlayer2D
|
||||||
|
@export var speaker_shutdown : AudioStreamPlayer2D
|
||||||
|
@export var speaker_keypress : AudioStreamPlayer2D
|
||||||
|
@export var speaker_punch : AudioStreamPlayer2D
|
||||||
|
|
||||||
|
var fullstring = ""
|
||||||
|
var lettercount = 0
|
||||||
|
var origpos_shotgun
|
||||||
|
var markerIndex = 0
|
||||||
|
var blinking = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
for l in letterArray_signature_joined: l.text = ""
|
||||||
|
for l in letterArray_signature_separate: l.text = ""
|
||||||
|
parent_signatureMachineMainParent.visible = false
|
||||||
|
await get_tree().create_timer(2, false).timeout
|
||||||
|
if (roundManager.playerData.hasSignedWaiver == false): SetupWaiver()
|
||||||
|
|
||||||
|
func BlinkMarker():
|
||||||
|
while(blinking):
|
||||||
|
marker.modulate.a = 0
|
||||||
|
await get_tree().create_timer(.3, false).timeout
|
||||||
|
marker.modulate.a = 1
|
||||||
|
await get_tree().create_timer(.3, false).timeout
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
|
||||||
|
func SetupWaiver():
|
||||||
|
origpos_shotgun = parent_shotgun.transform.origin
|
||||||
|
parent_shotgun.transform.origin = Vector3(-1.738, -5, -0.041)
|
||||||
|
parent_waiver.transform.origin = Vector3(-29.613, -35.341, -6.696)
|
||||||
|
|
||||||
|
func AwaitPickup():
|
||||||
|
await get_tree().create_timer(.6, false).timeout
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
intrbranch_waiver.interactionAllowed = true
|
||||||
|
|
||||||
|
func PickUpWaiver():
|
||||||
|
speaker_bootup.play()
|
||||||
|
parent_signatureMachineMainParent.visible = true
|
||||||
|
intrbranch_waiver.interactionAllowed = false
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
anim_waiver.play("pickup waiver")
|
||||||
|
for letter in letterArray: letter.text = ""
|
||||||
|
UpdateMarkerPosition()
|
||||||
|
UpdateLEDArray()
|
||||||
|
blinking = true
|
||||||
|
BlinkMarker()
|
||||||
|
await get_tree().create_timer(2.77, false).timeout #.9 anim speed
|
||||||
|
for intbr in intbranches : intbr.interactionAllowed = true
|
||||||
|
cursor.SetCursor(true, true)
|
||||||
|
|
||||||
|
func GetInput(letterAlias : String, specialAlias : String):
|
||||||
|
speaker_keypress.pitch_scale = randf_range(.95, 1)
|
||||||
|
speaker_keypress.play()
|
||||||
|
var input
|
||||||
|
if (letterAlias != ""): input = letterAlias
|
||||||
|
else: input = specialAlias
|
||||||
|
if (input != "backspace" && input != "enter"):
|
||||||
|
Input_Letter(input)
|
||||||
|
else: if (input == "enter"):
|
||||||
|
Input_Enter()
|
||||||
|
else: if (input == "backspace"):
|
||||||
|
Input_Backspace()
|
||||||
|
|
||||||
|
func Input_Letter(alias : String):
|
||||||
|
if (markerIndex != 6):
|
||||||
|
if (letterArray[markerIndex].text == ""): letterArray[markerIndex].text = alias
|
||||||
|
if (markerIndex != 6): markerIndex += 1
|
||||||
|
UpdateMarkerPosition()
|
||||||
|
UpdateLEDArray()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func Input_Enter():
|
||||||
|
var chararray = []
|
||||||
|
fullstring = ""
|
||||||
|
for letter in letterArray:
|
||||||
|
if (letter.text != ""):
|
||||||
|
chararray.append(letter.text)
|
||||||
|
for l in chararray: fullstring += l
|
||||||
|
lettercount = chararray.size()
|
||||||
|
if (fullstring == ""): return
|
||||||
|
if (fullstring == "dealer"): return
|
||||||
|
if (fullstring == "god"): return
|
||||||
|
if (fullstring != ""):
|
||||||
|
for br in intbranches:
|
||||||
|
var el = br.get_parent().get_child(2)
|
||||||
|
br.interactionAllowed = false
|
||||||
|
el.set_collision_layer_value(1, false)
|
||||||
|
el.set_collision_mask_value(1, false)
|
||||||
|
cursor.SetCursor(false, false)
|
||||||
|
await get_tree().create_timer(.25, false).timeout
|
||||||
|
for i in range(lettercount):
|
||||||
|
letterArray_signature_joined[i].text = chararray[i].to_upper()
|
||||||
|
letterArray_signature_separate[i].text = chararray[i].to_upper()
|
||||||
|
ledArray[i].visible = false
|
||||||
|
await get_tree().create_timer(.17, false).timeout
|
||||||
|
speaker_punch.pitch_scale = randf_range(.95, 1)
|
||||||
|
speaker_punch.play()
|
||||||
|
await get_tree().create_timer(.17, false).timeout
|
||||||
|
parent_shotgun.transform.origin = origpos_shotgun
|
||||||
|
anim_waiver.play("put away waiver")
|
||||||
|
speaker_bootup.stop()
|
||||||
|
speaker_shutdown.play()
|
||||||
|
roundManager.playerData.playername = fullstring
|
||||||
|
roundManager.playerData.hasSignedWaiver = true
|
||||||
|
ReturnToMainBatch()
|
||||||
|
await get_tree().create_timer(1.72, false).timeout
|
||||||
|
parent_signatureMachineMainParent.visible = false
|
||||||
|
parent_separateWaiver.visible = false
|
||||||
|
await get_tree().create_timer(.4, false).timeout
|
||||||
|
parent_waiver.queue_free()
|
||||||
|
|
||||||
|
func ReturnToMainBatch():
|
||||||
|
await get_tree().create_timer(1.27, false).timeout
|
||||||
|
roundManager.enteringFromWaiver = true
|
||||||
|
roundManager.MainBatchSetup(false)
|
||||||
|
|
||||||
|
func Input_Backspace():
|
||||||
|
if (markerIndex != 6 && markerIndex != 0): letterArray[markerIndex - 1].text = ""
|
||||||
|
if (markerIndex == 6): letterArray[markerIndex - 1].text = ""
|
||||||
|
if (markerIndex != 0): markerIndex -= 1
|
||||||
|
UpdateMarkerPosition()
|
||||||
|
UpdateLEDArray()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func UpdateMarkerPosition():
|
||||||
|
if(markerIndex != 6): marker.transform.origin = posArray_marker[markerIndex]
|
||||||
|
if (markerIndex == 5 && letterArray[markerIndex].text != ""): marker.visible = false
|
||||||
|
else: if (markerIndex == 6): marker.visible = false
|
||||||
|
else: marker.visible = true
|
||||||
|
|
||||||
|
func UpdateLEDArray():
|
||||||
|
for i in range(ledArray.size()):
|
||||||
|
if letterArray[i].text != "":
|
||||||
|
ledArray[i].transparency = 0
|
||||||
|
else:
|
||||||
|
ledArray[i].transparency = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
15
SmokeController.gd
Normal file
15
SmokeController.gd
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
class_name SmokeController extends Node
|
||||||
|
|
||||||
|
@export var particle_barrel : GPUParticles3D
|
||||||
|
@export var particle_chamber : GPUParticles3D
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
SpawnSmoke("barrel")
|
||||||
|
SpawnSmoke("chamber")
|
||||||
|
|
||||||
|
func SpawnSmoke(alias : String):
|
||||||
|
match (alias):
|
||||||
|
"barrel":
|
||||||
|
particle_barrel.restart()
|
||||||
|
"chamber":
|
||||||
|
particle_chamber.restart()
|
81
SpeakerController.gd
Normal file
81
SpeakerController.gd
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
class_name SpeakerController extends Node
|
||||||
|
|
||||||
|
@export var fadeDuration : float
|
||||||
|
@export var fadeDuration_pitch : float
|
||||||
|
@export var lowestPitchValue : float
|
||||||
|
var speaker : AudioStreamPlayer2D
|
||||||
|
var elapsed = 0
|
||||||
|
var elapsed_pitch = 0
|
||||||
|
var moving = false
|
||||||
|
var moving_pitch = false
|
||||||
|
var originalVolumeDB : float
|
||||||
|
var originalPitch : float
|
||||||
|
var currentPitch : float
|
||||||
|
var nextPitch : float
|
||||||
|
var currentVolume : float
|
||||||
|
var nextVolume : float
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
speaker = self.get_parent()
|
||||||
|
originalVolumeDB = speaker.volume_db
|
||||||
|
originalPitch = speaker.pitch_scale
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
LerpVolume()
|
||||||
|
LerpPitch()
|
||||||
|
|
||||||
|
func SnapVolume(state : bool):
|
||||||
|
moving = false
|
||||||
|
if (state): speaker.volume_db = originalVolumeDB
|
||||||
|
else: speaker.volume_db = linear_to_db(0)
|
||||||
|
|
||||||
|
func BeginPitchShift(pitchFrom : float, pitchTo : float):
|
||||||
|
moving_pitch = false
|
||||||
|
elapsed_pitch = 0
|
||||||
|
currentPitch = pitchFrom
|
||||||
|
nextPitch = pitchTo
|
||||||
|
moving_pitch = true
|
||||||
|
|
||||||
|
func FadeIn():
|
||||||
|
elapsed = 0
|
||||||
|
currentVolume = db_to_linear(speaker.volume_db)
|
||||||
|
nextVolume = db_to_linear(originalVolumeDB)
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func FadeOut():
|
||||||
|
elapsed = 0
|
||||||
|
currentVolume = db_to_linear(speaker.volume_db)
|
||||||
|
nextVolume = 0
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func LerpVolume():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / fadeDuration, 0.0, 1.0)
|
||||||
|
var vol = lerpf(currentVolume, nextVolume, c)
|
||||||
|
speaker.volume_db = linear_to_db(vol)
|
||||||
|
|
||||||
|
func LerpPitch():
|
||||||
|
if (moving_pitch):
|
||||||
|
elapsed_pitch += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed_pitch / fadeDuration_pitch, 0.0, 1.0)
|
||||||
|
c = ease(c, 0.4)
|
||||||
|
var pitch = lerpf(currentPitch, nextPitch, c)
|
||||||
|
speaker.pitch_scale = pitch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
81
SpeakerController3D.gd
Normal file
81
SpeakerController3D.gd
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
class_name SpeakerController3D extends Node
|
||||||
|
|
||||||
|
@export var fadeDuration : float
|
||||||
|
@export var fadeDuration_pitch : float
|
||||||
|
@export var lowestPitchValue : float
|
||||||
|
var speaker : AudioStreamPlayer3D
|
||||||
|
var elapsed = 0
|
||||||
|
var elapsed_pitch = 0
|
||||||
|
var moving = false
|
||||||
|
var moving_pitch = false
|
||||||
|
var originalVolumeDB : float
|
||||||
|
var originalPitch : float
|
||||||
|
var currentPitch : float
|
||||||
|
var nextPitch : float
|
||||||
|
var currentVolume : float
|
||||||
|
var nextVolume : float
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
speaker = self.get_parent()
|
||||||
|
originalVolumeDB = speaker.volume_db
|
||||||
|
originalPitch = speaker.pitch_scale
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
LerpVolume()
|
||||||
|
LerpPitch()
|
||||||
|
|
||||||
|
func SnapVolume(state : bool):
|
||||||
|
moving = false
|
||||||
|
if (state): speaker.volume_db = originalVolumeDB
|
||||||
|
else: speaker.volume_db = linear_to_db(0)
|
||||||
|
|
||||||
|
func BeginPitchShift(pitchFrom : float, pitchTo : float):
|
||||||
|
moving_pitch = false
|
||||||
|
elapsed_pitch = 0
|
||||||
|
currentPitch = pitchFrom
|
||||||
|
nextPitch = pitchTo
|
||||||
|
moving_pitch = true
|
||||||
|
|
||||||
|
func FadeIn():
|
||||||
|
elapsed = 0
|
||||||
|
currentVolume = db_to_linear(speaker.volume_db)
|
||||||
|
nextVolume = db_to_linear(originalVolumeDB)
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func FadeOut():
|
||||||
|
elapsed = 0
|
||||||
|
currentVolume = db_to_linear(speaker.volume_db)
|
||||||
|
nextVolume = 0
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func LerpVolume():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / fadeDuration, 0.0, 1.0)
|
||||||
|
var vol = lerpf(currentVolume, nextVolume, c)
|
||||||
|
speaker.volume_db = linear_to_db(vol)
|
||||||
|
|
||||||
|
func LerpPitch():
|
||||||
|
if (moving_pitch):
|
||||||
|
elapsed_pitch += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed_pitch / fadeDuration_pitch, 0.0, 1.0)
|
||||||
|
c = ease(c, 0.4)
|
||||||
|
var pitch = lerpf(currentPitch, nextPitch, c)
|
||||||
|
speaker.pitch_scale = pitch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
22
TempDeathScreen.gd
Normal file
22
TempDeathScreen.gd
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
class_name TempDeathScreen extends Node
|
||||||
|
|
||||||
|
@export var isDeathScreen : bool
|
||||||
|
@export var savefile : SaveFileManager
|
||||||
|
@export var viewblocker : ColorRect
|
||||||
|
@export var speaker : AudioStreamPlayer2D
|
||||||
|
var allowed = true
|
||||||
|
var fs = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
if (isDeathScreen):
|
||||||
|
get_tree().change_scene_to_file("res://scenes/main.tscn")
|
||||||
|
|
||||||
|
#func _unhandled_input(event):
|
||||||
|
# if (event.is_action_pressed("enter") && allowed && !fs):
|
||||||
|
# viewblocker.color = Color(0, 0, 0, 1)
|
||||||
|
# speaker.pitch_scale = .8
|
||||||
|
# await get_tree().create_timer(.5, false).timeout
|
||||||
|
# if (!isDeathScreen):
|
||||||
|
# savefile.ClearSave()
|
||||||
|
# get_tree().change_scene_to_file("res://scenes/main.tscn")
|
||||||
|
# allowed = false
|
40
TextFire.gd
Normal file
40
TextFire.gd
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
class_name TextFire extends Node
|
||||||
|
|
||||||
|
var ui : Control
|
||||||
|
var speaker : AudioStreamPlayer2D
|
||||||
|
@export var max_x : float
|
||||||
|
@export var max_y : float
|
||||||
|
@export var duration : float
|
||||||
|
|
||||||
|
var orig_x : float
|
||||||
|
var orig_y : float
|
||||||
|
var moving = false
|
||||||
|
var elapsed = 0
|
||||||
|
var changed = false
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
speaker = get_parent().get_child(1)
|
||||||
|
ui = get_parent()
|
||||||
|
|
||||||
|
func Fire():
|
||||||
|
if (!changed): speaker.pitch_scale = randf_range(.95, 1)
|
||||||
|
speaker.play()
|
||||||
|
orig_x = ui.scale.x
|
||||||
|
orig_y = ui.scale.y
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
ui.visible = true
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
Lerp()
|
||||||
|
|
||||||
|
func Lerp():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / duration, 0.0, 1.0)
|
||||||
|
c = ease(c, 0.4)
|
||||||
|
var temp_x = lerpf(max_x, orig_x, c)
|
||||||
|
var temp_y = lerpf(max_y, orig_y, c)
|
||||||
|
ui.scale.x = temp_x
|
||||||
|
ui.scale.y = temp_y
|
52
TextInteraction.gd
Normal file
52
TextInteraction.gd
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
class_name TextInteraction extends Node
|
||||||
|
|
||||||
|
@export var text : Label3D
|
||||||
|
@export var interaction : InteractionManager
|
||||||
|
@export var dur : float
|
||||||
|
@export var colorvalue_min : float
|
||||||
|
@export var colorvalue_max : float
|
||||||
|
|
||||||
|
var elapsed = 0
|
||||||
|
var moving = false
|
||||||
|
var fs1 = true
|
||||||
|
var fs2 = false
|
||||||
|
var colorvalue_current = 0.0
|
||||||
|
var colorvalue_next = 0.0
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
CheckStatus()
|
||||||
|
LerpOpacity()
|
||||||
|
|
||||||
|
func CheckStatus():
|
||||||
|
if (interaction.activeParent == text):
|
||||||
|
if (!fs1):
|
||||||
|
BeginLerp()
|
||||||
|
fs2 = false
|
||||||
|
fs1 = true
|
||||||
|
else:
|
||||||
|
if (!fs2):
|
||||||
|
EndLerp()
|
||||||
|
fs1 = false
|
||||||
|
fs2 = true
|
||||||
|
|
||||||
|
func BeginLerp():
|
||||||
|
colorvalue_current = text.modulate.r
|
||||||
|
colorvalue_next = colorvalue_max
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func EndLerp():
|
||||||
|
colorvalue_current = text.modulate.r
|
||||||
|
colorvalue_next = colorvalue_min
|
||||||
|
elapsed = 0
|
||||||
|
moving = true
|
||||||
|
pass
|
||||||
|
|
||||||
|
func LerpOpacity():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / dur, 0.0, 1.0)
|
||||||
|
var color = lerp(colorvalue_current, colorvalue_next, c)
|
||||||
|
text.modulate = Color(color, color, color, text.modulate.a)
|
||||||
|
pass
|
24
TextShaker.gd
Normal file
24
TextShaker.gd
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
class_name TextShaker extends Node
|
||||||
|
|
||||||
|
@export var delay : float
|
||||||
|
@export var offset1 : float
|
||||||
|
@export var offset2 : float
|
||||||
|
@export var text : Control
|
||||||
|
var looping = false
|
||||||
|
var origpos
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
origpos = text.position
|
||||||
|
looping = true
|
||||||
|
Shake()
|
||||||
|
|
||||||
|
func Shake():
|
||||||
|
while(looping):
|
||||||
|
var randx = randf_range(offset1, offset2)
|
||||||
|
var randy = randf_range(offset1, offset2)
|
||||||
|
text.position = Vector2(randx, randy)
|
||||||
|
await get_tree().create_timer(delay, false).timeout
|
||||||
|
text.position = origpos
|
||||||
|
await get_tree().create_timer(delay, false).timeout
|
||||||
|
pass
|
||||||
|
pass
|
36
TimeScaleManager.gd
Normal file
36
TimeScaleManager.gd
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
class_name TimeScaleManager extends Node
|
||||||
|
|
||||||
|
@export var pitchShiftDuration : float
|
||||||
|
@export var timeScaleLerpDuration : float
|
||||||
|
|
||||||
|
var moving = false
|
||||||
|
var elapsed = 0
|
||||||
|
var from
|
||||||
|
var to
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
LerpTimeScale()
|
||||||
|
|
||||||
|
#func _unhandled_input(event):
|
||||||
|
# if (event.is_action_pressed("debug_left")):
|
||||||
|
# moving = false
|
||||||
|
# Engine.time_scale = 1
|
||||||
|
# if (event.is_action_pressed("debug_right")):
|
||||||
|
# moving = false
|
||||||
|
# Engine.time_scale = 10
|
||||||
|
|
||||||
|
func BeginTimeScaleLerp(start : float, end : float):
|
||||||
|
moving = false
|
||||||
|
elapsed = 0
|
||||||
|
from = start
|
||||||
|
to = end
|
||||||
|
moving = true
|
||||||
|
|
||||||
|
func LerpTimeScale():
|
||||||
|
if (moving):
|
||||||
|
elapsed += get_process_delta_time()
|
||||||
|
var c = clampf(elapsed / timeScaleLerpDuration, 0.0 , 1.0)
|
||||||
|
c = ease(c, 0.4)
|
||||||
|
var val = lerpf(from, to, c)
|
||||||
|
Engine.time_scale = val
|
8
TrackInstance.gd
Normal file
8
TrackInstance.gd
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
class_name TrackInstance extends Resource
|
||||||
|
|
||||||
|
@export var trackName : String
|
||||||
|
@export var audiofile : AudioStream
|
||||||
|
@export var audiofile_secondloop : AudioStream
|
||||||
|
@export var defaultLowPassHz : float
|
||||||
|
@export var correspondingBatchIndex : int
|
||||||
|
@export var bpmIncrement : float
|
44
TypingManager.gd
Normal file
44
TypingManager.gd
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
class_name TypingManager extends Node
|
||||||
|
|
||||||
|
@export var speaker_click : AudioStreamPlayer2D
|
||||||
|
@export var dialogueUI : Label3D
|
||||||
|
@export var dialogueSpeed : float
|
||||||
|
@export var incrementDelay : float
|
||||||
|
|
||||||
|
var elapsed = 0
|
||||||
|
var moving = false
|
||||||
|
var looping = false
|
||||||
|
|
||||||
|
func ShowText_ForDuration(activeText : String, showDuration : float):
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible_characters = 0
|
||||||
|
dialogueUI.text = activeText
|
||||||
|
dialogueUI.visible = true
|
||||||
|
looping = true
|
||||||
|
TickText()
|
||||||
|
await get_tree().create_timer(showDuration, false).timeout
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible = false
|
||||||
|
|
||||||
|
func ShowText_Forever(activeText : String):
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible_characters = 0
|
||||||
|
dialogueUI.text = activeText
|
||||||
|
dialogueUI.visible = true
|
||||||
|
looping = true
|
||||||
|
TickText()
|
||||||
|
|
||||||
|
func HideText():
|
||||||
|
looping = false
|
||||||
|
dialogueUI.visible = false
|
||||||
|
pass
|
||||||
|
|
||||||
|
func TickText():
|
||||||
|
while(looping):
|
||||||
|
dialogueUI.visible_characters += 1
|
||||||
|
speaker_click.play()
|
||||||
|
if (dialogueUI.visible_ratio >= 1):
|
||||||
|
looping = false
|
||||||
|
await get_tree().create_timer(incrementDelay, false).timeout
|
||||||
|
pass
|
||||||
|
pass
|
2
gridBranch.gd
Normal file
2
gridBranch.gd
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
extends Node
|
||||||
|
@export var activeIndex : int
|
Loading…
Reference in New Issue
Block a user