#@tool
#@icon(icon_path: String)
#class_name MyNode
extends Node
## Documentation comments

## signal
## enum
## const
## @export var
var musicians: Array[Node]
var musician_lights: Array[Node]

@onready var rhythm_manager: RhythmManager = %RhythmManager
@onready var conductor: AnimatedSprite2D = $Conductor
@onready var conductor_light: PointLight2D = %ConductorLight
@onready var click_track: AudioStreamPlayer2D = %ClickTrack

## OVERRIDES

func _ready() -> void:
	musicians = get_tree().get_nodes_in_group("musicians")
	musician_lights = get_tree().get_nodes_in_group("musician_lights")
	rhythm_manager.connect("song_started", on_song_started)
#func _process(delta: float) -> void:
	#pass
#
#func _physics_process(delta: float) -> void:
	#pass

func _unhandled_input(event: InputEvent) -> void:
	if event.is_action_pressed("ready"):
		conductor.play("default")
		conductor_light.visible = true
		click_track.play()
## CORE

## PRIVATE/HELPER
 
## RECEIVERS

func on_song_started() -> void:
	for musician in musicians:
		musician.play("default")
	for light in musician_lights:
		light.visible = true

## SETTERS/GETTERS
