예제 #1
0
 public void OnCollisionEnter2D(Collision2D collision)
 {
     if (Item.Contain_Item("Key") && !door.isTrigger)
     {
         door.isTrigger = true;
         Item.Remove_Item("Key");
     }
 }
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         if (Item.Contain_Item("Key"))
         {
             Item.Remove_Item("Key");
             Destroy(gameObject);
         }
         else
         {
             HealthControl healthscript = GameObject.FindGameObjectWithTag("Player").GetComponent <HealthControl>();
             healthscript.GetDamage(healthscript.health, false, 1f);
         }
     }
 }