// 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) { boss = animator.GetComponentInParent <GiantEyeBoss>(); sr = animator.GetComponent <SpriteRenderer>(); rb = animator.GetComponentInParent <Rigidbody2D>(); timeBtwShotsValue = timeBtwShots; timeBtwFlashValue = timeBtwFlash; flashTimeValue = flashTime; defMat = sr.material; rb.velocity = Vector2.zero; }
// 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) { player = GameObject.FindGameObjectWithTag("Player").transform; rb = animator.GetComponentInParent <Rigidbody2D>(); sr = animator.GetComponentInChildren <SpriteRenderer>(); defMat = sr.material; boss = animator.GetComponentInParent <GiantEyeBoss>(); dashTimeValue = dashTime; attackTimeValue = attackTime; chargeTimeValue = chargeTime; boss.audioManager.StopMusic(); boss.audioManager.PlayMusic("BossFight"); boss.isInvulnerable = false; }