godot-psd-training/sceen/Area3D/APassageAreaDetection.gd
2024-07-15 10:29:36 +08:00

13 lines
355 B
GDScript

extends Area3D
var passPeopleCount = 0
func _ready():
self.connect("area_entered",Callable(self,"_on_area_entered"))
func _on_area_entered(area: Area3D) -> void:
var peopleWalkFollow = area.get_parent().get_parent()
if peopleWalkFollow is PlayerPathFollow :
passPeopleCount += 1
self.disconnect("area_entered",Callable(self,"_on_area_entered"))