1 using System.Collections;
2 using System.Collections.Generic;
5 public class BossMovement : StateMachineBehaviour
10 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
11 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
13 fp = animator.GetComponent<FollowPlayer>();
14 boss = animator.GetComponent<Boss>();
17 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
18 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
22 if (fp.distToPlayer < fp.agroRange - 20)
24 animator.SetBool("Idle", false);
25 animator.SetBool("Attack", true);
27 else if (fp.distToPlayer > fp.agroRange)
29 animator.SetBool("Idle", true);
30 animator.SetBool("Attack", false);
35 animator.SetBool("Idle", true);
36 animator.SetBool("Attack", false);
40 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
41 override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
43 animator.SetBool("Attack", false);
44 animator.SetBool("Idle", false);