29 lines
618 B
GDScript
29 lines
618 B
GDScript
extends State
|
|
class_name BeeIdle
|
|
|
|
@onready var bee = get_parent().get_parent() as Bee # I think this is bad but I dont care it works
|
|
|
|
var idle_time : float = 0.0
|
|
|
|
func enter(_msg := {}):
|
|
#animator.play("Idle")
|
|
pass
|
|
|
|
func update(delta : float):
|
|
|
|
idle_time += delta
|
|
|
|
if idle_time > 2.0:
|
|
find_something_to_do()
|
|
idle_time = 0.0
|
|
pass
|
|
|
|
func find_something_to_do():
|
|
if bee.nectar > 0:
|
|
Log.pr("I have pollen, time to move..")
|
|
## Bee has pollen - head home
|
|
state_transition.emit(self, "Travelling")
|
|
else:
|
|
## Bee has no pollen - they should move to a flower
|
|
state_transition.emit(self, "Travelling")
|
|
pass
|