コード例 #1
0
 private void OnCollisionEnter2D(Collision2D other)
 {
     // Checks that no item is being held
     if (heldItem == null)
     {
         // Checks if colliding item is a fruit
         if (
             other.gameObject.CompareTag("Cherry") ||
             other.gameObject.CompareTag("Avocado") ||
             other.gameObject.CompareTag("Eggplant")
             )
         {
             heldItem = other.gameObject.tag;
             itemDisplay.EnableImage(heldItem);
             Destroy(other.gameObject);
         }
     }
 }