Ejemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("PowerUp_Item"))
     {
         if (Singleton.GetInstance.ShotBulletCount < 6)
         {
             Singleton.GetInstance.ShotBulletCount++;
         }
         Singleton.GetInstance.ShotBulletAngle += 5;
         collision.gameObject.SetActive(false);
     }
     else if (collision.CompareTag("SpeedUp_Item"))
     {
         if (Singleton.GetInstance.Hero_Move_Speed < 0.6f)
         {
             Singleton.GetInstance.Hero_Move_Speed += 0.05f;
         }
         collision.gameObject.SetActive(false);
     }
     else if (collision.CompareTag("ShotSpeedUp_Item"))
     {
         Singleton.GetInstance.Next_Shot_Delay -= 0.05f;
         collision.gameObject.SetActive(false);
     }
     else if (collision.CompareTag("Enemy"))
     {
         Hp_bar.fillAmount -= 0.2f;
         if (Hp_bar.fillAmount <= 0.1f)
         {
             UM.ShowResult();
             result.SetActive(true);
         }
         collision.gameObject.SetActive(false);
     }
 }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Bullet"))
     {
         Hp--;
         if (Hp == 0)
         {
             UI.AddScore();
             gameObject.SetActive(false);
             if (gameObject.name == "Monster_YouDo(Clone)")
             {
                 Instantiate(items[Random.Range(0, 3)], transform.position, Quaternion.identity);
             }
             if (gameObject.name == "Boss")
             {
                 UI.ShowResult();
                 R.SetActive(true);
             }
         }
         collision.gameObject.SetActive(false);
     }
     if (collision.CompareTag("Wall") && gameObject.name != "Boss")
     {
         if (transform.rotation.z > 0)
         {
             transform.rotation = Quaternion.Euler(0, 0, Random.Range(-90, 0));
         }
         else
         {
             transform.rotation = Quaternion.Euler(0, 0, Random.Range(0, 90));
         }
     }
 }