Files
zeling_v2/Assets/Scripts/Enemies/EnemyAnimationConfigSO.cs
2026-05-12 15:34:08 +08:00

45 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
namespace BaseGames.Enemies
{
/// <summary>
/// 敌人动画配置 SO架构 07_EnemyModule §5
/// 所有字段为 AnimationClip由 Animancer 直接播放。
/// </summary>
[CreateAssetMenu(menuName = "Enemies/AnimationConfig")]
public class EnemyAnimationConfigSO : ScriptableObject
{
[Header("基础")]
public AnimationClip Idle;
public AnimationClip Walk;
public AnimationClip Run;
[Header("战斗")]
public AnimationClip Attack;
[Header("受击")]
public AnimationClip Hurt;
public AnimationClip Stagger;
public AnimationClip Dead;
/// <summary>
/// 按字段名返回 ClipBD_PlayAnimation 使用)。
/// 支持字段名和常见别名(如 Attack_Melee / Idle 等)。
/// </summary>
public AnimationClip GetClipByName(string name)
{
return name switch
{
"Idle" => Idle,
"Walk" => Walk,
"Run" => Run,
"Attack" or "Attack_Melee" => Attack,
"Hurt" => Hurt,
"Stagger" => Stagger,
"Dead" or "Death" => Dead,
_ => null,
};
}
}
}