extends Polygon2D

# Parameters for the sector
var center = Vector2()  # The center point of the sector
var radius = 200.0      # The radius of the sector
var start_angle   # The starting angle in radians
var end_angle  # The ending angle in radians
@export var rangeNumber = PI / 6;
var segments = 32       # The number of segments used to draw the sector

func _ready():
	start_angle = 3 * PI / 2 - rangeNumber;
	end_angle = 3 * PI / 2 + rangeNumber;
	update_polygon()

func update_polygon():
	var points = []
	points.append(center)

	# Calculate the vertices for the sector
	for i in range(segments + 1):
		var angle = start_angle + i * (end_angle - start_angle) / segments
		points.append(center + Vector2(cos(angle), sin(angle)) * radius)

	# Set the vertices to the Polygon2D
	self.polygon = points
