extends Node2D
class_name Flowers

@onready var outline = $AreaHighlight

@export var health : int = 100

var spawn_snails : bool = false

@onready var spawn_area = $FlowerCollectionArea/CollisionShape2D
@onready var snail = $Snail

func _ready():
	hide_outline()

	## Check if this level is spawning snails or not 
	if GameState.spawn_snails:
		Log.pr("Going to be spawning snails!")
		spawn_snails = true

	Log.pr(get_random_snail_spawn())
	snail.global_position = get_random_snail_spawn()


func show_outline():
	outline.visible = true

func hide_outline():
	outline.visible = false


func get_random_snail_spawn():
	var circle_radius = spawn_area.shape.radius
	var random_angle = randf_range(0, TAU)

	var x = circle_radius * cos(random_angle)
	var y = circle_radius * sin(random_angle)

	var circle_center = spawn_area.global_position
	var random_point = circle_center + Vector2(x, y)

	return random_point