Exemplo n.º 1
0
 public override void Update()
 {
     base.Update();
     if (Hp <= 0 && destroyTime > -2)
     {
         BGMSource.Stop();
         destroyTime -= Time.deltaTime;
     }
     if (destroyTime <= -2)//多給兩秒的休息時間
     {
         bossDieDialogComponent.SetActive(true);
         if (BGMSource.clip != afterBGM)
         {
             BGMSource.clip = afterBGM;
             BGMSource.Play();
         }
     }
     if (Hp <= maxHp * 0.7 && !bossState[0])
     {
         animator.SetTrigger("Wheel_1_Broke");
         audioSource.PlayOneShot(behindWheelBrokeSFX);
         invincibleGuard = Instantiate(BossInvincibleEffect, BossInvinciblePos.position, BossInvinciblePos.rotation);
         Time.timeScale  = 0f;
         bossSecondStateDialog.SetActive(true);
         bossState[0] = true;
     }
     else if (Hp <= maxHp * 0.3 && !bossState[1])
     {
         animator.SetTrigger("Wheel_2_Broke");
         audioSource.PlayOneShot(behindWheelBrokeSFX);
         bossController.BossUltAttack();
         Destroy(invincibleGuard);
         //第三階段提示
         bossThirdStateDialog.SetActive(true);
         bossState[1] = true;
     }
     if (Hp <= 0 && timer < destroySoundTime)
     {
         timer += Time.deltaTime;
         if (timer >= destroySoundTime)
         {
             audioSource.PlayOneShot(wheelBrokeSFX);
         }
     }
 }