class_name RangeTowerComponent extends TowerComponent signal range_changed @warning_ignore("shadowed_global_identifier") var range := 0: set(value): range = value range_changed.emit() @onready var area: Area2D = $Range @onready var collision_shape := $Range/CollisionShape2D @onready var shape: CircleShape2D = collision_shape.shape var units_in_range: Array[Unit] func _ready() -> void: update_range() level_changed.connect(update_range) func update_range(): var tile_size = Client.current_stage.map.tile_set.tile_size.x @warning_ignore("integer_division") range = (tile_size * 2) + ((tile_size / 2) * level) shape.radius = range func on_add(tower: Tower): super.on_add(tower) area.position = tower.get_node("CenterAnchor").position func _on_range_body_entered(body: Node2D) -> void: units_in_range.append(body) func _on_range_body_exited(body: Node2D) -> void: units_in_range.erase(body)