2019-10-28 01:21:41 +01:00
|
|
|
extends KinematicBody
|
|
|
|
|
|
|
|
|
2019-10-30 01:01:02 +01:00
|
|
|
export(NodePath) var _visibility_path: NodePath
|
|
|
|
|
|
|
|
var _visibility: Area
|
|
|
|
|
|
|
|
|
2019-10-28 01:21:41 +01:00
|
|
|
func _ready():
|
2019-11-11 10:16:03 +01:00
|
|
|
Logger.set_logger_level(Logger.LOG_LEVEL_FINE)
|
2019-10-30 01:01:02 +01:00
|
|
|
_visibility = get_node(_visibility_path) as Area
|
|
|
|
|
|
|
|
if _visibility:
|
|
|
|
_visibility.connect("body_entered", self, "_on_body_entered_visibility")
|
|
|
|
_visibility.connect("body_exited", self, "_on_body_exited_visibility")
|
|
|
|
|
|
|
|
|
|
|
|
func _on_body_entered_visibility(body: Node):
|
|
|
|
if body.is_in_group("Player"):
|
|
|
|
print("Seeing player!")
|
2019-11-02 20:06:20 +01:00
|
|
|
Logger.info("Seeing player!")
|
2019-10-30 01:01:02 +01:00
|
|
|
# TODO: Check if the Player is in an area where they shouldn't be
|
|
|
|
|
|
|
|
# TODO: Follow the Player
|
|
|
|
|
2019-10-28 01:21:41 +01:00
|
|
|
|
2019-10-30 01:01:02 +01:00
|
|
|
func _on_body_exited_visibility(body: Node):
|
|
|
|
if body.is_in_group("Player"):
|
|
|
|
print("Stopped seeing player!")
|
2019-11-02 20:06:20 +01:00
|
|
|
Logger.info("Stopped seeing player!")
|
2019-10-30 01:01:02 +01:00
|
|
|
# TODO: Stop following the Player
|