extends Area

export var color = ""
onready var timer = get_node("Timer")

var finished = false
var triggered = false

signal box_button_status_changed


func _on_BaseBoxButton_body_entered(body):
	if body.color == color and body.is_in_group("group_box"):
			#print ("this is the same color...")
		if (timer.is_stopped()):
			timer.start()


func _on_BaseBoxButton_body_exited(body):
	triggered = false
	emit_signal("box_button_status_changed")
	#print ("untriggered")

func _on_Timer_timeout():
	for body in get_overlapping_bodies ( ):
		if body.color == color and body.is_in_group("group_box"):
			triggered = true
			emit_signal("box_button_status_changed")
			#print ("triggered")
