extends Node

export (Array, AudioStream) var music_list = []

var music_index = 0

onready var Player = $AudioStreamPlayer

func list_play():
	assert(music_list.size() > 0)
	Player.stream = music_list[music_index]
	Player.play()
	music_index += 1
	if music_index == music_list.size():
		music_index = 0

func list_stop():
	Player.stop()

func _on_AudioStreamPlayer_finished():
	music_list.shuffle()
	list_play()
