Bees return nectar, UI stuff

This commit is contained in:
Dan Baker 2024-05-04 15:13:59 +01:00
parent 76e7ec7ec7
commit 5865778c77
12 changed files with 175 additions and 17 deletions

View file

@ -5,10 +5,11 @@ class_name BeeTravelling
@onready var bee = get_parent().get_parent() as Bee # I think this is bad but I dont care it works
var t = 0
var return_to_hive : bool = false
func enter(_msg := {}):
Log.pr("I am on the move!")
return_to_hive = false
## Get the next target location from the bee
if bee.just_gathering:
target = bee.get_current_director() # We want to go back the way we came
@ -16,12 +17,22 @@ func enter(_msg := {}):
else:
target = bee.get_next_target()
Log.pr(bee, target)
# If we have no target, we are returning to the hive
if !target:
Log.pr("No more drones to visit, going to go back to the hive")
return_to_hive = true
bee.animation_player.play("Flying")
pass
func update(delta : float) -> void:
if return_to_hive:
state_transition.emit(self, "Returning")
return
if target:
if bee.position.distance_to(target.position) > 3:
@ -36,4 +47,3 @@ func update(delta : float) -> void:
else:
state_transition.emit(self, "Idle")
pass