Files
2026-05-02 20:03:54 -03:00

37 lines
1.1 KiB
GDScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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()