extends Node2D

onready var buttonPlayer = $"%ButtonPlayer"
onready var activatorArea = $"%ActivatorArea"
onready var indicator1Player = $"%Indicator1Player"
onready var indicator2Player = $"%Indicator2Player"
onready var indicator3Player = $"%Indicator3Player"

export var buttonID: int;

func selfActivate():
	var selfPlayerString = "indicator"+String(buttonID)+"Player"
	get(selfPlayerString).play("onning")
	buttonPlayer.play("pushing")
	#TODO dis importante
	activatorArea.set_deferred("monitoring", false)

func activateIDIndicator(id: int):
	var selfPlayerString = "indicator"+String(id)+"Player"
	get(selfPlayerString).play("onning")

func _on_ActivatorArea_area_entered(_area:Area2D) -> void:
	selfActivate()
	if get_parent().has_signal("child_button_activated"):
		get_parent().emit_signal("child_button_activated", buttonID)


