extends Control

@onready var score = $VBoxContainer3/VBoxContainer2/ScoreValue
@onready var time = $VBoxContainer3/VBoxContainer/Time
@onready var timeValue = $VBoxContainer3/VBoxContainer/TimeValue
@onready var mode = $VBoxContainer3/VBoxContainer3/ModeValue

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	score.text = str(GLOBAL.points)
	timeValue.text = str(GLOBAL.convertIntToTime(GLOBAL.time))
	if GLOBAL.currentMode == GLOBAL.MODES.INFINITE:
		time.text = "Time Played"
		mode.text = "Infinite"
	elif GLOBAL.currentMode == GLOBAL.MODES.TIME:
		time.text = "Time Left"
		mode.text = "Time"
	GLOBAL.resetGame()

func _on_play_again_button_pressed() -> void:
	get_parent().get_parent().loadGrid()

func _on_home_pressed() -> void:
	get_parent().get_parent().loadStartMenu()
