Exemple #1
0
 private void OnTriggerEnter(Collider collision)
 {
     if (collision.gameObject.tag == "m_Bullet" && canHurt)
     {
         Debug.Log("Hurt");
         StartCoroutine(HurtCoroutine());
         if (hp <= 0)
         {
             SceneManager.LoadScene(0);
         }
     }
     else if (collision.gameObject.tag == "i_HP")
     {
         hp += (int)(maxHp * 0.2f);
         if (hp > maxHp)
         {
             hp = maxHp;
         }
         Destroy(collision.gameObject);
     }
     else if (collision.gameObject.tag == "i_LV")
     {
         if (level < 5)
         {
             LevelUp();
         }
         Destroy(collision.gameObject);
     }
     else if (collision.gameObject.tag == "EXP")
     {
         exp   += 1;
         score += 50;
         if (exp >= needExp[level] && level < 5)
         {
             LevelUp();
         }
         Destroy(collision.gameObject);
     }
     else if (collision.gameObject.tag == "i_Guard")
     {
         StopCoroutine(bulletShot.Guard2Coroutine());
         StopCoroutine(bulletShot.BoomCoroutine());
         bulletShot.canBoom  = 1;
         bulletShot.canGuard = 1;
         Destroy(collision.gameObject);
     }
 }