47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System.Collections;
|
|
using Yarn.Unity;
|
|
|
|
namespace AibisDream
|
|
{
|
|
// Yarn 命令说明见同目录 AnimatorYarnCommand.md
|
|
public static class AnimatorYarnCommand
|
|
{
|
|
[YarnCommand("play_animation")]
|
|
public static IEnumerator PlayAnimation(string animatorName, string stateName)
|
|
{
|
|
yield return AnimatorCenter.Instance.PlayAnimationAsync(animatorName, stateName);
|
|
}
|
|
|
|
[YarnCommand("play_animation_addressable")]
|
|
public static IEnumerator PlayAnimationAddressable(string animatorName, string addressableKey, string stateName)
|
|
{
|
|
yield return AnimatorCenter.Instance.PlayAnimationFromAddressableAsync(animatorName, addressableKey,
|
|
stateName);
|
|
}
|
|
|
|
[YarnCommand("reset_animation")]
|
|
public static void ResetAnimation(string animatorName)
|
|
{
|
|
AnimatorCenter.Instance.ResetAnimation(animatorName);
|
|
}
|
|
|
|
[YarnCommand("hide_animation")]
|
|
public static void HideAnimation(string animatorName)
|
|
{
|
|
AnimatorCenter.Instance.HideAnimation(animatorName);
|
|
}
|
|
|
|
[YarnCommand("start_random_animation")]
|
|
public static void StartRandomAnimation(string handlerName)
|
|
{
|
|
AnimatorCenter.Instance.StartRandomAnimation(handlerName);
|
|
}
|
|
|
|
[YarnCommand("stop_random_animation")]
|
|
public static void StopRandomAnimation(string handlerName)
|
|
{
|
|
AnimatorCenter.Instance.StopRandomAnimation(handlerName);
|
|
}
|
|
}
|
|
}
|