Bee State Machine

This commit is contained in:
Dan 2024-05-03 15:43:05 +01:00
parent 20bcab01b1
commit 752131c955
16 changed files with 467 additions and 13 deletions

View file

@ -0,0 +1,29 @@
extends State
class_name BeeGathering
@export var animator : AnimationPlayer
@onready var bee = get_parent().get_parent() as Bee # I think this is bad but I dont care it works
var time_at_patch : float = 0.0
func enter(_msg := {}):
Log.pr("I am going to attempt to gather some stuff!")
#animator.play("Idle")
#if !bee.in_range_of_flowers:
# ## Go home bee, you're drunk
# state_transition.emit(self, "Idle")
func update(_delta : float):
if bee.in_range_of_flowers:
#animator.play("Gathering")
time_at_patch += _delta
if time_at_patch > 5.0:
bee.nectar += 1
state_transition.emit(self, "Idle")
else:
state_transition.emit(self, "Idle")