diff --git a/Audio/Music/Streaming2_draft_r2_session.ogg b/Audio/Music/Streaming2_draft_r2_session.ogg new file mode 100644 index 0000000..87dda82 Binary files /dev/null and b/Audio/Music/Streaming2_draft_r2_session.ogg differ diff --git a/Audio/Music/Streaming2_draft_r2_session.ogg.import b/Audio/Music/Streaming2_draft_r2_session.ogg.import new file mode 100644 index 0000000..50856b9 --- /dev/null +++ b/Audio/Music/Streaming2_draft_r2_session.ogg.import @@ -0,0 +1,15 @@ +[remap] + +importer="ogg_vorbis" +type="AudioStreamOGGVorbis" +path="res://.import/Streaming2_draft_r2_session.ogg-979b5a41f4df6d7ab3dc1c40adf88c6b.oggstr" + +[deps] + +source_file="res://Audio/Music/Streaming2_draft_r2_session.ogg" +dest_files=[ "res://.import/Streaming2_draft_r2_session.ogg-979b5a41f4df6d7ab3dc1c40adf88c6b.oggstr" ] + +[params] + +loop=true +loop_offset=0 diff --git a/Scenes/RootNode.tscn b/Scenes/RootNode.tscn index 7746ac6..d196750 100644 --- a/Scenes/RootNode.tscn +++ b/Scenes/RootNode.tscn @@ -34,3 +34,5 @@ stream = ExtResource( 5 ) autoplay = true bus = "Music" script = ExtResource( 4 ) + +[connection signal="finished" from="AudioStreamPlayer" to="AudioStreamPlayer" method="_on_finished"] diff --git a/Scripts/AudioStreamPlayer.gd b/Scripts/AudioStreamPlayer.gd index ddd4bc3..fcc0cdc 100644 --- a/Scripts/AudioStreamPlayer.gd +++ b/Scripts/AudioStreamPlayer.gd @@ -4,14 +4,20 @@ 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") +var streaming_2 : AudioStreamOGGVorbis = preload("res://Audio/Music/Streaming2_draft_r2_session.ogg") -var music_dict = {"main" : main_theme, "combat" : combat_theme} +var music_dict = {"main" : [ main_theme ], "combat" : [ combat_theme, streaming_2 ]} + +var current_music_array : String = "main" func switch_theme(name : String) -> void: if name in music_dict.keys(): - stream = music_dict[name] + var music_list = music_dict[name] + music_list.shuffle() + stream = music_list[0] + current_music_array = name else: - get_parent().console_print("Could not find music of name, " + name) + get_parent().console_print("Could not find music array of name, " + name) playing = true func _process(delta : float) -> void: @@ -22,3 +28,7 @@ func _process(delta : float) -> void: AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), true) mute_status = !mute_status + + +func _on_finished(): + switch_theme(current_music_array) diff --git a/Scripts/RootNode.gd b/Scripts/RootNode.gd index ac03ee6..4d36e5d 100644 --- a/Scripts/RootNode.gd +++ b/Scripts/RootNode.gd @@ -12,6 +12,7 @@ var name_dict = {} var color_dict = {} func _ready() -> void: + randomize() get_tree().connect("connected_to_server", self, "_connected_to_server") get_tree().connect("server_disconnected", self, "_server_disconnected") get_tree().connect("connection_failed", self, "_connection_failed")