add gathering awaiting

This commit is contained in:
2024-10-08 05:50:05 +10:00
parent f144e79ea5
commit a8e179d60c
10 changed files with 92 additions and 71 deletions

View File

@@ -31,13 +31,12 @@ func _ready() -> void:
for i in MAX_CARRY:
item_bones.append(skeleton.find_bone(ITEM_BONE_NAME + str(i)))
gathering.initialize(anthill, skeleton, item_bones, MAX_CARRY, 0.4, 1)
gathering.target_set.connect(_on_gathering_target_set)
gathering.stopped_gathering.connect(_on_stopped_gathering)
gathering.navigate_to.connect(_on_gathering_navigate_to)
func _process(delta: float) -> void:
super._process(delta)
if moving_to_target:
if is_relocating:
state = AntGathererState.MOVING
_handle_wandering(delta)
@@ -58,7 +57,7 @@ func _handle_wandering(delta: float) -> void:
func _handle_gathering() -> void:
gathering.handle_gathering(state != AntGathererState.GATHERING, showing_info)
gathering.handle_gathering(showing_info)
func _on_moving_ended() -> void:
@@ -71,12 +70,8 @@ func _on_moving_started() -> void:
state = AntGathererState.MOVING
func _on_gathering_target_set(pos: Vector3) -> void:
func _on_gathering_navigate_to(pos: Vector3) -> void:
if state != AntGathererState.GATHERING:
return
nav_agent.set_target_position(pos)
func _on_stopped_gathering() -> void:
state = AntGathererState.WANDERING
navigate(pos)