ai refactoring

This commit is contained in:
2026-05-22 00:06:23 +02:00
parent b22f219a5e
commit 0c237430ea
10 changed files with 67 additions and 68 deletions

View File

@@ -3,6 +3,10 @@ extends Node
class_name State
@export var state_id: StringName = &""
@export var next_state_id: StringName
@export var animation_name: String
@onready var agent: AIBase = owner
@warning_ignore("unused_signal")
signal transitioned(state: State, new_state_id: StringName)
@@ -18,3 +22,9 @@ func update(_delta) -> void:
func physics_update(_delta) -> void:
pass
func run_animation() -> void:
if agent.anim_player and agent.anim_player.has_animation(animation_name):
var anim = agent.anim_player.get_animation(animation_name)
anim.loop_mode = Animation.LOOP_LINEAR
agent.anim_player.play(animation_name)