Add muzak, muffled screams, virtua hand
This commit is contained in:
parent
acb10d18a4
commit
54067d2087
15 changed files with 198 additions and 29 deletions
|
|
@ -7,11 +7,16 @@ const CHASE_LONG := preload("res://audio/Chase1.wav")
|
|||
const CHASE_TRACKS := [CHASE_SHORT_1, CHASE_SHORT_2, CHASE_MID, CHASE_LONG]
|
||||
static var _last_chase: AudioStream = null
|
||||
|
||||
const SCREAM_OPEN_DB := 0.0
|
||||
const SCREAM_CLOSED_DB := -20.0
|
||||
|
||||
var speed: int = 3
|
||||
var clumsiness: int = 0
|
||||
var _saved: bool = false
|
||||
var _in_safety_zone: bool = false
|
||||
|
||||
@onready var safety_zone: Node = get_node_or_null("/root/Game/World/ElevatorSafeZone")
|
||||
@onready var _elevator: Node = safety_zone.get_node_or_null("Elevator") if safety_zone else null
|
||||
|
||||
|
||||
#func start(xform):
|
||||
|
|
@ -30,16 +35,31 @@ func _ready():
|
|||
)
|
||||
|
||||
func _physics_process(_delta):
|
||||
velocity.z = -speed
|
||||
var p: float = _elevator.get_door_close_progress() if _elevator else 0.0
|
||||
if _in_safety_zone and not _saved and p > 0.49:
|
||||
velocity.z = 0
|
||||
else:
|
||||
velocity.z = -speed
|
||||
move_and_slide()
|
||||
if _elevator:
|
||||
$ScreamPlayer.volume_db = lerp(SCREAM_OPEN_DB, SCREAM_CLOSED_DB, p)
|
||||
|
||||
func _on_area_3d_area_entered(area: Area3D) -> void:
|
||||
if area == safety_zone and not _saved:
|
||||
_saved = true
|
||||
if area == safety_zone and not _in_safety_zone:
|
||||
_in_safety_zone = true
|
||||
var elevator = safety_zone.get_node_or_null("Elevator")
|
||||
if elevator and elevator.get_door_close_progress() > 0.7:
|
||||
EventBus.survivor_squeaked_in.emit()
|
||||
var close_progress: float = elevator.get_door_close_progress() if elevator else 0.0
|
||||
if close_progress > 0.49:
|
||||
return
|
||||
get_tree().create_timer(0.5, false).timeout.connect(
|
||||
func(): queue_free(),
|
||||
func():
|
||||
if not is_instance_valid(self):
|
||||
return
|
||||
var elev = safety_zone.get_node_or_null("Elevator")
|
||||
var final_progress: float = elev.get_door_close_progress() if elev else 0.0
|
||||
if final_progress > 0.49:
|
||||
return
|
||||
_saved = true
|
||||
queue_free(),
|
||||
CONNECT_ONE_SHOT
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue