chore: adjusted animations and tree logic
This commit is contained in:
parent
5214b60ff0
commit
a02f00c7a2
3 changed files with 5 additions and 4 deletions
|
|
@ -11,10 +11,11 @@ func _enter():
|
|||
anim_started = false
|
||||
anim.play(attack_name, .0)
|
||||
anim.advance(0)
|
||||
return Running
|
||||
|
||||
func _execute() -> int:
|
||||
if anim.current_animation == attack_name:
|
||||
anim_started = true
|
||||
elif anim_started:
|
||||
return Success if body.attack_queued else Fail
|
||||
return Success
|
||||
return Running
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ extends BehaviourAction
|
|||
|
||||
@onready var body := owner
|
||||
|
||||
func _execute() -> int:
|
||||
func _enter() -> int:
|
||||
if body.attack_queued:
|
||||
body.attack_queued = false
|
||||
return Success
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ func _unhandled_input(event : InputEvent):
|
|||
input.x = Input.get_axis(\"move_left\", \"move_right\")
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func _execute() -> int:
|
||||
func _enter() -> int:
|
||||
if input.is_zero_approx():
|
||||
return Fail
|
||||
var camera_basis : Basis = get_viewport().get_camera_3d().global_basis
|
||||
|
|
@ -70,7 +70,7 @@ func _execute() -> int:
|
|||
resource_name = "PlayerIdle"
|
||||
script/source = "extends BehaviourAction
|
||||
|
||||
func _execute() -> int:
|
||||
func _enter() -> int:
|
||||
get_behaviour_tree().get_node(\"%AnimationPlayer\").play(\"ready\", .1)
|
||||
(owner as CharacterBody3D).velocity = Vector3()
|
||||
return Success
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue