Example #1
0
    // 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));
    }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     rb           = GetComponent <Rigidbody2D>();
     objectSeeker = GetComponent <ObjectSeeker>();
     SetDirection(GetRandomDirection());
 }