godot-psd-training/sceen/Area3D/APassageAreaDetection.gd

13 lines
355 B
GDScript3
Raw Normal View History

2024-07-09 17:27:43 +08:00
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"))