Files
gpd-326-en/AI/Assets/Scripts/StateMachineBehaviours/TestStateBehaviour.cs
T

53 lines
1.8 KiB
C#

using UnityEngine;
using UnityEngine.InputSystem;
namespace AI.StateMachineBehaviours
{
public class TestStateBehaviour : StateMachineBehaviour
{
private static readonly int IS_EXIT = Animator.StringToHash("IsExit");
[SerializeField] private InputActionReference inputActionReference;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Debug.Log("TestStateBehaviour OnStateEnter");
inputActionReference.action.Enable();
}
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Debug.Log("TestStateBehaviour OnStateExit");
inputActionReference.action.Disable();
}
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Debug.Log("TestStateBehaviour OnStateUpdate");
if (inputActionReference.action.triggered)
{
animator.SetTrigger(IS_EXIT);
}
}
public override void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Debug.Log("TestStateBehaviour OnStateIK");
}
public override void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Debug.Log("TestStateBehaviour OnStateMove");
}
public override void OnStateMachineEnter(Animator animator, int stateMachinePathHash)
{
Debug.Log("TestStateBehaviour OnStateMachineEnter");
}
public override void OnStateMachineExit(Animator animator, int stateMachinePathHash)
{
Debug.Log("TestStateBehaviour OnStateMachineExit");
}
}
}