BITKit/Src/Unity/Scripts/Animator/AnimatorHelper.cs

26 lines
882 B
C#
Raw Normal View History

2023-06-05 19:57:17 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit
{
public class AnimatorHelper : MonoBehaviour
{
2023-10-24 23:38:22 +08:00
[SerializeField] private Transform root;
2024-05-31 01:23:15 +08:00
[SerializeField] private bool allowAnimatorMove;
2023-10-24 23:38:22 +08:00
private void OnAnimatorMove()
2023-06-05 19:57:17 +08:00
{
2024-05-31 01:23:15 +08:00
if (root && allowAnimatorMove)
2024-03-31 23:31:00 +08:00
root.SendMessageUpwards(nameof(OnAnimatorMove),SendMessageOptions.DontRequireReceiver);
}
private void AIAnimationEvent(string actionName)
{
if (root)
root.SendMessage(nameof(AIAnimationEvent), actionName,SendMessageOptions.DontRequireReceiver);
}
public void AnimationEvent(string eventName)
{
if(root)
root.SendMessage(nameof(AnimationEvent), eventName,SendMessageOptions.DontRequireReceiver);
2023-06-05 19:57:17 +08:00
}
}
}