22 lines
400 B
GDScript
22 lines
400 B
GDScript
extends AudioStreamPlayer
|
|
|
|
export var min_wait: float
|
|
export var max_wait: float
|
|
|
|
func start_timer():
|
|
var wait = rand_range(min_wait, max_wait)
|
|
$Timer.start(wait)
|
|
|
|
func _on_Timer_timeout():
|
|
play()
|
|
|
|
func _on_sound_finished():
|
|
start_timer()
|
|
|
|
var needs_bootstrap = true
|
|
|
|
func _process(_delta):
|
|
if needs_bootstrap and Util.player.camera_position().y < -18:
|
|
needs_bootstrap = false
|
|
start_timer()
|