コード例 #1
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Enemy")
     {
         m_nLife--;
         Destroy(collision.gameObject);
         m_scLifebars.Down(1);
         if (m_nLife <= 0)
         {
             Destroy(gameObject);
         }
     }
 }
コード例 #2
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Adventurer")
     {
         m_nLife--;
         Destroy(collision.gameObject);
         m_scLifebars.Down(1);
         if (m_nLife == 0)
         {
             BulletMNG.I.AllRemoveBullet();
             Destroy(gameObject);
         }
     }
 }