// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { mm = animator.GetComponent <MonsterMove>(); nmAgent = animator.GetComponent <NavMeshAgent>(); nmAgent.speed = chaseSpeed; nmAgent.isStopped = false; mm.GetComponent <Rigidbody>().isKinematic = true; }
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (!animator.GetCurrentAnimatorStateInfo(0).IsName("Base Layer.Combat.MeleeChase1") && !animator.GetCurrentAnimatorStateInfo(0).IsName("Base Layer.Combat.MeleeChase")) // { nmAgent.isStopped = true; mm.GetComponent <Rigidbody>().isKinematic = false; } }