This repository has been archived on 2020-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
2020-07-07 07:40:20 +00:00
|
|
|
extends Area2D
|
|
|
|
|
|
|
|
class_name ActivationRange
|
|
|
|
|
2020-07-13 19:01:36 +00:00
|
|
|
signal player_entered(player)
|
|
|
|
signal player_left(player)
|
2020-07-07 07:40:20 +00:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
connect("body_entered", self, "_body_entered")
|
|
|
|
connect("body_exited", self, "_body_left")
|
|
|
|
|
|
|
|
func in_range():
|
|
|
|
return overlaps_body($"/root/scene/world".player)
|
|
|
|
|
|
|
|
func _body_entered(body: Node):
|
|
|
|
if body == $"/root/scene/world".player:
|
2020-07-13 19:01:36 +00:00
|
|
|
emit_signal("player_entered", body)
|
2020-07-07 07:40:20 +00:00
|
|
|
|
|
|
|
func _body_left(body: Node):
|
|
|
|
if body == $"/root/scene/world".player:
|
2020-07-13 19:01:36 +00:00
|
|
|
emit_signal("player_left", body)
|