Fix enemy return ball two times each time

This commit is contained in:
Mathilde Grapin 2023-07-01 17:12:02 +02:00
parent a9a9f05296
commit 2b11ec8638
10 changed files with 29 additions and 42 deletions

View file

@ -3,8 +3,8 @@ extends ConditionLeaf
func tick(actor, _blackboard):
if (
actor.next_target != null &&
actor.ball_in_game() &&
actor.next_destination != null &&
!actor.collide_with_ball
):
return SUCCESS

View file

@ -4,8 +4,8 @@ extends ConditionLeaf
func tick(actor, _blackboard):
if (
actor.ball_in_game() &&
actor.next_target != null &&
actor.collide_with_ball
actor.collide_with_ball &&
!actor.ball_aims_to_bottom
):
return SUCCESS
return FAILURE

View file

@ -1,10 +0,0 @@
class_name CanWaitCodition
extends ConditionLeaf
func tick(actor, _blackboard):
if (
actor.next_target == null
):
return SUCCESS
return FAILURE

View file

@ -2,5 +2,5 @@ class_name GetBallDestinationAction
extends ActionLeaf
func tick(actor: Node, blackboard: Blackboard):
blackboard.set_value("destination", actor.next_target)
blackboard.set_value("destination", actor.next_destination)
return SUCCESS

View file

@ -11,6 +11,7 @@ func tick(actor: Node, blackboard: Blackboard):
actor.move_to(destination)
if actor.position == destination:
actor.next_destination == null
return SUCCESS
return RUNNING

View file

@ -4,7 +4,7 @@ extends ActionLeaf
func before_run(actor, _blackboard):
actor.play_hit_ball_animation()
func tick(actor, blackboard):
func tick(actor, _blackboard):
if !actor.hit_ball_animation_finished:
return RUNNING
actor.throw_ball()

View file

@ -1,8 +0,0 @@
class_name WaitAction
extends ActionLeaf
func before_run(actor, _blackboard):
actor.play_idle_animation()
func tick(_actor, _blackboard):
return RUNNING