using UnityEngine;
using UnityEngine.Events;

public class SMBEventReceiver : StateMachineBehaviour {

    public UnityEvent onStateEnter;
    public UnityEvent onStateExit;
    public UnityEvent onStateUpdate;
    public UnityEvent onStateMove;
    public UnityEvent onStateIK;

    /// 新しいステートに移り変わった時に実行
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){
        onStateEnter.Invoke();
    }
    /// ステートが次のステートに移り変わる直前に実行
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){
        onStateExit.Invoke();
    }
    /// 最初と最後のフレームを除く、各フレーム単位で実行
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){
        onStateUpdate.Invoke();
    }
    /// MonoBehaviour.OnAnimatorMoveの直後に実行
    override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){
        onStateMove.Invoke();
    }
    /// MonoBehaviour.OnAnimatorIKの直後に実行される
    override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){
        onStateIK.Invoke();
    }
}
