Subindo repositorio
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var _animation_tree: AnimationTree = $AnimationTree
|
||||
@onready var _main_state_machine: AnimationNodeStateMachinePlayback = _animation_tree.get("parameters/StateMachine/playback")
|
||||
@onready var _secondary_action_timer: Timer = $SecondaryActionTimer
|
||||
|
||||
|
||||
func _on_secondary_action_timer_timeout() -> void:
|
||||
if _main_state_machine.get_current_node() != "Idle":
|
||||
return
|
||||
_main_state_machine.travel("Shake")
|
||||
_secondary_action_timer.start(randf_range(3.0, 8.0))
|
||||
|
||||
|
||||
## Sets the model to a neutral, action-free state.
|
||||
func idle() -> void:
|
||||
_main_state_machine.travel("Idle")
|
||||
_secondary_action_timer.start()
|
||||
|
||||
|
||||
## Sets the model to a walking animation or forward movement.
|
||||
func walk() -> void:
|
||||
_main_state_machine.travel("Walk")
|
||||
|
||||
|
||||
## Plays a one-shot attack animation.
|
||||
## This animation does not play in parallel with other states.
|
||||
func attack() -> void:
|
||||
_main_state_machine.travel("Attack")
|
||||
|
||||
|
||||
## Plays a one-shot power-off animation.
|
||||
## This animation does not play in parallel with other states.
|
||||
func power_off() -> void:
|
||||
_main_state_machine.travel("PowerOff")
|
||||
_secondary_action_timer.stop()
|
||||
Reference in New Issue
Block a user