31 lines
880 B
C#
31 lines
880 B
C#
using System.Collections;
|
|
using Animancer;
|
|
using UnityEngine;
|
|
|
|
namespace BaseGames.Enemies.Abilities
|
|
{
|
|
/// <summary>
|
|
/// 播放单个动画 Clip 并等待完成后退出(无副作用)。
|
|
/// 可复用于任何需要"播一段动画即完成"的能力(如出场激活、台词演出等)。
|
|
/// </summary>
|
|
public class PlayClipAbility : EnemyAbilityBase
|
|
{
|
|
private PlayClipAbilitySO _cfg;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
_cfg = ResolveConfig<PlayClipAbilitySO>();
|
|
}
|
|
|
|
protected override IEnumerator ExecuteCoroutine()
|
|
{
|
|
Phase = AbilityRunState.Active;
|
|
if (_cfg == null || _cfg.clip.Clip == null) yield break;
|
|
|
|
_animancer.Play(_cfg.clip);
|
|
yield return EnemyAbilityWaits.Get(_cfg.clip.Clip.length);
|
|
}
|
|
}
|
|
}
|