Files
project-thought-experiment/scripts/autoloads/music_manager.gd
2024-01-28 23:26:59 +01:00

19 lines
458 B
GDScript

extends Node
@onready var soundeffect: SoundEffect = $SoundEffect
func _ready() -> void:
_on_level_switched()
LevelManager.level_switched.connect(_on_level_switched)
func _on_level_switched() -> void:
print(get_tree().current_scene.name)
match get_tree().current_scene.name:
"MainMenu":
await get_tree().create_timer(.4).timeout
soundeffect.play_key("main")
"LVL1":
soundeffect.play_key("lvl1")
"LVL2":
soundeffect.play_key("lvl2")