//If we should chase the player, go to chase state, if not and we don't have a path, go back to idle public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (ChaseState.ShouldChasePlayer(animator.transform.position)) { animator.SetInteger(IdleState.transitionParameter, (int)Transition.CHASE); } else if (!navAgent.hasPath) { animator.SetInteger(IdleState.transitionParameter, (int)Transition.IDLE); } }
//Check if we should chase the player, if not - Set a random destination if we don't already have one public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (ChaseState.ShouldChasePlayer(animator.transform.position)) { animator.SetInteger(transitionParameter, (int)Transition.CHASE); } else { if (navAgent.hasPath) { animator.SetInteger(transitionParameter, (int)Transition.WANDER); } else { SetRandomDestination(navAgent); } } }