ft (wip): hammerhead predator
This commit is contained in:
18
evolve-die-repeat/molecular/predator/state_machine.gd
Normal file
18
evolve-die-repeat/molecular/predator/state_machine.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
extends StateMachine
|
||||
|
||||
enum States {IDLE, RANDOMMOVEMENT, FEEDING, FLEEING, HUNTING}
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
super()
|
||||
await owner.ready
|
||||
|
||||
|
||||
func transition_to_next_state(target: int, data: Dictionary = {}) -> void:
|
||||
match target:
|
||||
States.IDLE: _transition_to_next_state("Idle", data)
|
||||
States.RANDOMMOVEMENT: _transition_to_next_state("RandomMovement", data)
|
||||
States.FEEDING: _transition_to_next_state("Feeding", data)
|
||||
States.FLEEING: _transition_to_next_state("Fleeing", data)
|
||||
States.HUNTING: _transition_to_next_state("Hunting", data)
|
||||
_: push_error("Trying to transition to unknown state {target}")
|
||||
Reference in New Issue
Block a user