Added: Unity scene and assets for AI state machine demo

This commit is contained in:
2026-11-05 18:29:57 +01:00
parent ad3a142d83
commit 05c3126e50
83 changed files with 8077 additions and 0 deletions
@@ -0,0 +1,53 @@
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");
}
}
}