Global Sounds system
This commit is contained in:
parent
5677971bf0
commit
ba3306c04c
15 changed files with 232 additions and 1 deletions
18
autoloads/global_sounds.gd
Normal file
18
autoloads/global_sounds.gd
Normal file
|
@ -0,0 +1,18 @@
|
|||
@tool
|
||||
extends Node
|
||||
|
||||
|
||||
@export_tool_button("Update Sounds") var _update_sounds_action = _update_sounds
|
||||
@export var sounds: Dictionary[StringName, AudioStreamPlayer]
|
||||
|
||||
|
||||
func play_sound(id: StringName) -> void:
|
||||
var sound := sounds.get(id) as AudioStreamPlayer
|
||||
sound.play()
|
||||
|
||||
func _update_sounds() -> void:
|
||||
sounds.clear()
|
||||
for node in get_children():
|
||||
if node is AudioStreamPlayer:
|
||||
sounds[node.name] = node
|
||||
notify_property_list_changed()
|
Loading…
Add table
Add a link
Reference in a new issue