iFactory.Cutting.Unity/Assets/BITKit/Unity/Scripts/Animator/AnimatorHelper.cs

26 lines
882 B
C#
Raw Normal View History

2024-01-23 02:56:26 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit
{
public class AnimatorHelper : MonoBehaviour
{
[SerializeField] private Transform root;
2024-04-22 03:48:37 +08:00
[SerializeField] private bool allowAnimatorMove;
2024-01-23 02:56:26 +08:00
private void OnAnimatorMove()
{
2024-04-22 03:48:37 +08:00
if (root && allowAnimatorMove)
2024-04-16 04:15:06 +08:00
root.SendMessageUpwards(nameof(OnAnimatorMove),SendMessageOptions.DontRequireReceiver);
2024-01-23 02:56:26 +08:00
}
private void AIAnimationEvent(string actionName)
{
if (root)
2024-04-16 04:15:06 +08:00
root.SendMessage(nameof(AIAnimationEvent), actionName,SendMessageOptions.DontRequireReceiver);
}
public void AnimationEvent(string eventName)
{
if(root)
root.SendMessage(nameof(AnimationEvent), eventName,SendMessageOptions.DontRequireReceiver);
2024-01-23 02:56:26 +08:00
}
}
}