16 lines
405 B
GDScript
16 lines
405 B
GDScript
extends Area3D
|
|
|
|
@export var health_component : HealthComponent
|
|
|
|
func _on_body_entered(body: Node3D) -> void:
|
|
if body is Projectile:
|
|
if is_instance_valid(health_component):
|
|
health_component.damage(body.damage)
|
|
body.projectile_collision()
|
|
|
|
|
|
func _on_area_entered(area: Area3D) -> void:
|
|
if area is ExplosionHurtbox:
|
|
if is_instance_valid(health_component):
|
|
health_component.damage(area.damage)
|