class_name Waypoint extends Control

var event : Quest.Event = null
var percent : float = 0
var filled: bool
var blink_tween : Tween
var blinking : bool = false
var fill: bool :
	get:
		return filled
	set(value):
		if value != filled:
			set_fill(value)

var fill_color: Color :
	get: return $Fill.self_modulate
	set(value):
		$Fill.self_modulate = value

func blink(blnk : bool) -> void:
	if blinking == blnk:
		return
	blinking = blnk
	if blinking:
		blink_tween = create_tween()
		blink_tween.tween_property($Dot,"modulate:a", 0, .5)
		blink_tween.tween_property($Dot,"modulate:a", 1, .5)
		blink_tween.set_loops(-1)
	else:
		blink_tween.stop()
		blink_tween = null

func set_fill(value : bool) -> void:
	filled = value
	if value and !blinking:
		$Dot.visible = true
		$Fill.modulate = Color.SEA_GREEN
	else:
		$Dot.visible = false
		$Fill.modulate = Color.BLACK
		
		
