extends RigidBody3D


@export var radius: float
@export var fog: FogVolume

var bounce_count: int = 0


func _on_body_entered(_body: Node) -> void:
	if bounce_count > 2:
		return
	bounce_count += 1
	if bounce_count == 2:
		smoke()

func smoke():
	var tween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_EXPO)
	tween.tween_property(fog,"size",Vector3(radius,radius,radius),1.0)
	tween.tween_interval(10)
	tween.tween_property(fog.material,"density",0,1.0)
	tween.tween_callback(queue_free)
