Files
Collin Campbell c208d069bb Implemented R-Tree
Would like to switch the identifer of the hole to a random string.
2025-11-23 18:22:00 -05:00

35 lines
764 B
GDScript

extends RefCounted
class_name Holes
var holes: Dictionary[int, Hole]
var counter: int = 0
func _init() -> void:
self.holes = {}
func add_hole(vectors: PackedVector2Array) -> Hole:
var hole = Hole.new(counter, vectors)
self.holes[counter] = hole
counter += 1
return hole
func remove_hole(hole_id: int):
self.holes.erase(hole_id)
func get_hole(hole_id: int) -> Hole:
return self.holes[hole_id]
func get_hole_verticies() -> PackedVector2Array:
var return_val: PackedVector2Array = []
for hole in holes.values():
return_val.append_array(hole.vectors)
return return_val
func get_holes() -> Array[PackedVector2Array]:
var return_val: Array[PackedVector2Array] = []
for hole in holes.values():
return_val.append(hole.vectors)
return return_val