2021-05-14 10:26:04 +00:00
|
|
|
extends AudioStreamPlayer
|
|
|
|
|
|
|
|
var mute_status : bool = false
|
|
|
|
|
|
|
|
var main_theme : AudioStreamOGGVorbis = preload("res://Audio/Music/SpaceMainTheme_r1_session.ogg")
|
|
|
|
var combat_theme : AudioStreamOGGVorbis = preload("res://Audio/Music/CombatThemeLBRY_r1_session.ogg")
|
2021-07-10 16:00:06 +00:00
|
|
|
var streaming_2 : AudioStreamOGGVorbis = preload("res://Audio/Music/Streaming2_draft_r2_session.ogg")
|
2021-05-14 10:26:04 +00:00
|
|
|
|
2021-07-10 16:00:06 +00:00
|
|
|
var music_dict = {"main" : [ main_theme ], "combat" : [ combat_theme, streaming_2 ]}
|
|
|
|
|
|
|
|
var current_music_array : String = "main"
|
2021-05-14 10:26:04 +00:00
|
|
|
|
|
|
|
func switch_theme(name : String) -> void:
|
|
|
|
if name in music_dict.keys():
|
2021-07-10 16:00:06 +00:00
|
|
|
var music_list = music_dict[name]
|
|
|
|
music_list.shuffle()
|
|
|
|
stream = music_list[0]
|
|
|
|
current_music_array = name
|
2021-05-14 10:26:04 +00:00
|
|
|
else:
|
2021-07-10 16:00:06 +00:00
|
|
|
get_parent().console_print("Could not find music array of name, " + name)
|
2021-05-14 10:26:04 +00:00
|
|
|
playing = true
|
|
|
|
|
|
|
|
func _process(delta : float) -> void:
|
|
|
|
if Input.is_action_just_pressed("mute") :
|
|
|
|
if mute_status:
|
|
|
|
AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), false)
|
|
|
|
else:
|
|
|
|
AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), true)
|
|
|
|
mute_status = !mute_status
|
|
|
|
|
2021-07-10 16:00:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_finished():
|
|
|
|
switch_theme(current_music_array)
|