Add wait action to enemy

This commit is contained in:
Mathilde Grapin 2023-06-12 17:58:06 +02:00
parent 1aed988149
commit 02026ab3e9
13 changed files with 236 additions and 15 deletions

View file

@ -0,0 +1,8 @@
class_name CanWaitCodition
extends ConditionLeaf
func tick(_actor, _blackboard):
var num = randi_range(0, 1)
if num == 0:
return SUCCESS
return FAILURE

View file

@ -1,4 +1,4 @@
class_name GetRandomTopCell
class_name GetRandomTopCellAction
extends ActionLeaf
func tick(actor, _blackboard):

View file

@ -1,5 +1,5 @@
class_name IsIdleCondition
extends ConditionLeaf
func tick(actor, _blackboard):
func tick(_actor, _blackboard):
return SUCCESS

View file

@ -1,7 +1,7 @@
class_name MoveToTargetAction
extends ActionLeaf
func before_run(actor, blackboard):
func before_run(actor, _blackboard):
actor.animation_player.play("walk")
func tick(actor, _blackboard):
@ -12,5 +12,5 @@ func tick(actor, _blackboard):
return SUCCESS
return RUNNING
func after_run(actor, blackboard):
func after_run(actor, _blackboard):
actor.animation_player.stop()

8
scripts/wait_action.gd Normal file
View file

@ -0,0 +1,8 @@
class_name WaitAction
extends ActionLeaf
func before_run(actor, _blackboard):
actor.animation_player.play("idle")
func tick(actor, blackboard):
return RUNNING