godot-psd-training/sceen/Area3D/ScreenDoorWaitArea.gd
2024-06-18 15:47:23 +08:00

19 lines
509 B
GDScript

extends Area3D
var waitPeopleCount = 0
signal ScreenDoorAreaEnter(curentArea: Area3D,peopleWalkFollow: PlayerPathFollow)
func _on_area_entered(area: Area3D) -> void:
var peopleWalkFollow = area.get_parent().get_parent()
if peopleWalkFollow is PlayerPathFollow :
waitPeopleCount += 1
ScreenDoorAreaEnter.emit(self,peopleWalkFollow)
func _on_area_exited(area: Area3D) -> void:
var peopleWalkFollow = area.get_parent().get_parent()
if peopleWalkFollow is PlayerPathFollow :
waitPeopleCount -= 1