// 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) { objectSeeker = animator.GetComponent <ObjectSeeker>(); EnemyMovement movement = animator.GetComponent <EnemyMovement>(); movement.SetDirection(movement.GetOppositeDirection(movement.currentMoveDirection)); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); objectSeeker = GetComponent <ObjectSeeker>(); SetDirection(GetRandomDirection()); }