extends Node2D

@export var target: Node

var night_manager = Global.game.night

func _process(_delta: float) -> void:
	queue_redraw()

func _draw() -> void:
	if target == null:
		return
	
	var nighttext := "TIME: %.2f\nHOUR: %d" % [
		night_manager.hour_timer,
		night_manager.current_hour
	]


	var text := "STATE: %s\nTIMER: %.2f\nLOCATION: %s" % [
		target.state,
		target.move_timer,
		target.current_location
	]

	draw_string(
		ThemeDB.fallback_font,
		Vector2(10, -10),
		text,
		HORIZONTAL_ALIGNMENT_LEFT,
		-1,
		14
	)
	draw_string(
		ThemeDB.fallback_font,
		Vector2(10, -30),
		nighttext,
		HORIZONTAL_ALIGNMENT_LEFT,
		-1,
		14
	)
