コード例 #1
0
 private void pickupWeapon()
 {
     // Shouldn't ever already have a weapon in the inventory
     if (!p_inv.hasItemType(item.itemType))
     {
         p_inv.addToInventory(item);
         GameObject playersHand = GameObject.FindGameObjectWithTag("Hand");
         if (equipItem != null)
         {
             equipItem.SetActive(true);
         }
         else
         {
             Debug.LogError("Did you forget to attach a gameobject to your collectible gameobject?");
         }
     }
     gameObject.SetActive(false); // Picked up, so disappear
 }