extends Node3D

@export var _spawn_point: Node3D
@export var _projectile_scene: PackedScene
@export var _velocity: Vector3 = Vector3.FORWARD
@export var _spawn_rate: float = 2

var _spawn_timer: float


func _ready() -> void:
	_spawn_timer = _spawn_rate


func _process(delta: float) -> void:
	if _spawn_timer <= 0:
		_spawn_timer = _spawn_rate
		var projectile := _projectile_scene.instantiate() as Projectile
		projectile.init(basis * _velocity, _spawn_point.global_position)
		add_child(projectile)

	_spawn_timer -= delta
