[agent:claude-cli] feat(audio): système audio complet — swim loop, boost, block break, echo ping, pearl collect, mort/respawn, deep sea ambient (placeholders AudioStreamGenerator si .ogg absent)

This commit is contained in:
2026-04-21 08:38:59 +00:00
parent 2e4d697977
commit 2c49e0c9db
4 changed files with 230 additions and 11 deletions

View File

@@ -40,6 +40,7 @@ var _is_dead: bool = false
@onready var bubble_trail: Node = $BubbleEmitterPoint/BubbleTrail
var _turn_input: float = 0.0
var _was_boosting: bool = false
func _ready() -> void:
@@ -161,6 +162,21 @@ func _update_movement(delta: float) -> void:
if bubble_trail:
bubble_trail.set_intensity(speed_factor)
# Audio: swim loop
var am: Node = get_node_or_null("/root/AudioManager")
if am != null:
if current_speed > 0.5:
if am.has_method("play_swim_loop"):
am.call("play_swim_loop")
else:
if am.has_method("stop_swim_loop"):
am.call("stop_swim_loop")
# Boost start sound
if is_boosting and not _was_boosting:
if am.has_method("play_boost"):
am.call("play_boost")
_was_boosting = is_boosting
func _update_stats(delta: float) -> void:
var changed: bool = false
@@ -197,6 +213,9 @@ func _emit_stats() -> void:
func _die() -> void:
_is_dead = true
player_died.emit()
var am: Node = get_node_or_null("/root/AudioManager")
if am != null and am.has_method("play_death"):
am.call("play_death")
# Respawn after short delay
await get_tree().create_timer(2.0).timeout
_respawn()
@@ -210,6 +229,9 @@ func _respawn() -> void:
hunger = max_hunger
_is_dead = false
_emit_stats()
var am: Node = get_node_or_null("/root/AudioManager")
if am != null and am.has_method("play_respawn"):
am.call("play_respawn")
func _animate_body() -> void:
@@ -290,5 +312,8 @@ func _trigger_echolocation() -> void:
echolocation_triggered.emit(global_position, 20.0)
if is_instance_valid(_echo_pulse):
_echo_pulse.trigger()
var am: Node = get_node_or_null("/root/AudioManager")
if am != null and am.has_method("play_echo_ping"):
am.call("play_echo_ping", global_position)
await get_tree().create_timer(1.2).timeout
is_echolocating = false