예제 #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Pacman")
     {
         Pacman pacman = collision.gameObject.GetComponent <Pacman>();
         if (pacman.GetPacmanInvincibility())
         {
             Destroy(gameObject);
         }
         else
         {
             level.LoseLife();
             Destroy(gameObject);
             if (level.GetLives() >= 1)
             {
                 pacman.HitByPill();
             }
         }
     }
     else if (collision.tag == "Barricade")
     {
         Destroy(gameObject);
         collision.gameObject.GetComponent <Barricade>().DegradeBarricade();
     }
 }