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

20 lines
585 B
GDScript3
Raw Normal View History

2024-07-09 17:27:43 +08:00
extends Area3D
2024-07-18 18:28:32 +08:00
var waitPeopleCount = 0
2024-07-09 17:27:43 +08:00
func _ready():
self.connect("area_entered",Callable(self,"_on_area_entered"))
2024-07-18 18:28:32 +08:00
self.connect("area_exited",Callable(self,"_on_area_exited"))
2024-07-09 17:27:43 +08:00
func _on_area_entered(area: Area3D) -> void:
var peopleWalkFollow = area.get_parent().get_parent()
if peopleWalkFollow is PlayerPathFollow :
2024-07-18 18:28:32 +08:00
waitPeopleCount += 1
#self.disconnect("area_entered",Callable(self,"_on_area_entered"))
func _on_area_exited(area: Area3D) -> void:
var peopleWalkFollow = area.get_parent().get_parent()
if peopleWalkFollow is PlayerPathFollow :
waitPeopleCount -= 1