2023-06-12 22:06:48 +02:00
|
|
|
class_name ThrowBallAction
|
|
|
|
extends ActionLeaf
|
|
|
|
|
|
|
|
func before_run(actor, _blackboard):
|
2023-06-27 21:25:32 +02:00
|
|
|
actor.play_throw_animation()
|
2023-06-12 22:06:48 +02:00
|
|
|
|
2023-06-18 20:30:25 +02:00
|
|
|
func tick(actor, blackboard):
|
2023-06-27 21:25:32 +02:00
|
|
|
if !actor.is_throw_animation_finished:
|
2023-06-12 22:06:48 +02:00
|
|
|
return RUNNING
|
|
|
|
else:
|
2023-06-18 20:30:25 +02:00
|
|
|
var target = blackboard.get_value("target")
|
|
|
|
actor.throw_ball(target)
|
2023-06-12 22:06:48 +02:00
|
|
|
actor.has_thrown_ball = true
|
|
|
|
return SUCCESS
|
|
|
|
|
|
|
|
func after_run(actor, _blackboard):
|
2023-06-18 20:30:25 +02:00
|
|
|
actor.animation_player.play("idle")
|