public void transfer(Item i)
 {
     if (other != null)
     {
         other.AddItem(i);
     }
     emptySlots++;
 }
示例#2
0
    protected void TryPickUpTargetItem()
    {
        if (!pickUpTarget)
        {
            return;
        }

        if ((pickUpTarget.transform.position - transform.position).magnitude < 2)
        {
            if (inventoryBehavior.AddItem(pickUpTarget.itemKey))
            {
                Destroy(pickUpTarget.gameObject);
                pickUpTarget = null;
            }
        }
    }
示例#3
0
    public void gotInteracted(InventoryBehavior inventory, Text message, Image bg)
    {
        mess   = message;
        bgMess = bg;
        Item i = GetComponent <Item>();

        if (inventory.AddItem(i))
        {
            photonView.RPC("hideAndShowIngre", PhotonTargets.AllBuffered);

            //string ingredientName = this.gameObject.GetComponent<Item>().id;
            //mess.text = string.Format("Added {0} into inventory", ingredientName);
        }
        else
        {
            mess.text = string.Format("Need more room in inventory");

            bgMess.enabled = true;
            Invoke("ClearText", 3);
        }
        //bgMess.enabled = true;
        //Invoke("ClearText", 2);
    }