2024-12-23 01:29:31 +00:00
|
|
|
extends Node
|
|
|
|
|
2024-12-30 13:19:10 +00:00
|
|
|
var sfx_players = [] as Array[AudioStreamPlayer]
|
|
|
|
var idx = 0
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
for i in range(5):
|
|
|
|
var sfx_player = RandomAudioStreamPlayer.new()
|
|
|
|
sfx_players.append(sfx_player)
|
|
|
|
sfx_player.bus = "game_sfx"
|
|
|
|
add_child(sfx_player)
|
|
|
|
|
2024-12-23 01:29:31 +00:00
|
|
|
|
2024-12-25 12:24:34 +00:00
|
|
|
func play_animation_sound(animation):
|
2024-12-26 13:58:37 +00:00
|
|
|
#TODO
|
|
|
|
print("Playing sound for animation: ", animation)
|
2024-12-25 12:24:34 +00:00
|
|
|
|
|
|
|
|
2024-12-30 13:19:10 +00:00
|
|
|
func play_sfx(sfx: AudioStream, db := 1.0) -> void:
|
|
|
|
sfx_players[idx].stream = sfx
|
|
|
|
sfx_players[idx].volume_db = db
|
|
|
|
sfx_players[idx].play()
|
|
|
|
idx = wrapi(idx + 1, 0, 5)
|