This commit is contained in:
incredibleLeitman 2020-01-26 22:31:48 +01:00
parent 2603ee53a0
commit 5e74ac4d23

View File

@ -1,11 +1,22 @@
extends NPC extends NPC
const diffPerSecond = 5
var _arrived_distance_threshold = 0.1
var _interactArea: Area var _interactArea: Area
var _navPath: Path
var _followPath: PathFollow
var _current_nav_index = 0
func _ready(): func _ready():
#Logger.set_logger_level(Logger.LOG_LEVEL_FINE) #Logger.set_logger_level(Logger.LOG_LEVEL_FINE)
_followPath = get_node("../") as PathFollow
assert(null != _followPath)
_navPath = get_node("../../") as Path
assert(null != _navPath)
var _interactArea = get_node("InteractArea") as Area var _interactArea = get_node("InteractArea") as Area
assert(null != _interactArea) assert(null != _interactArea)
_interactArea.connect("area_entered", self, "_on_area_entered") _interactArea.connect("area_entered", self, "_on_area_entered")
@ -13,11 +24,10 @@ func _ready():
func _process(_delta): func _process(_delta):
# TODO: movement # TODO: movement
#if current_target: # should not be needed -> handled per navigation path #if current_target: # should not be needed -> handled per navigation path
pass _followPath.offset += diffPerSecond * _delta
func _on_area_entered (area: Area): func _on_area_entered (area: Area):
if area.is_in_group("FactoryEntry"): if area.is_in_group("FactoryEntry"):
# despawn # despawn
queue_free() queue_free()
pass