public void ReloadItemInfoFromSave(Item _item, LEInventory inventory) { isInit = true; item = _item; //Add GUI Double Click callback to ItemOnGUIDoubleClickable iGUIDoubleClickable = GetComponentInParent <ItemOnGUIDoubleClickable>(); if (iGUIDoubleClickable != null) { //item.OnGUIDoubleClick will be call when we double click the GUI on inventory item.OnGUIDoubleClick = iGUIDoubleClickable.ItemOnGUIDoubleClick; } inventory.AddItem(item); transform.parent.parent = inventory.transform; transform.parent.gameObject.SetActive(false); }
//Picke Upable Object. When we double click on the object in the scene. private void OnMouseDown() { if (!clickManager.DoubleClick()) { return; } if (!isInit) { FetchItemInfo(); } //Find Player and Players inventory TargetLE lplayer = FindObjectOfType <TargetLE>(); LEInventory inventory = lplayer.transform.GetComponentInChildren <LEInventory>(); inventory.AddItem(item); transform.parent.parent = inventory.transform; transform.parent.gameObject.SetActive(false); CursorManager.GetInstance().setMouse(); }