public bool AddItem(Item item) { if (_crafter.AddItem(item)) { var ip = Instantiate(ItemPrefab, SlotParent).GetComponent <ItemDragHandler>(); ip.Item = item; ip.Crafter = this; ip.Inventory = _inventory; ip.InCraft = true; ip.OnDrop = () => { _crafter.RemoveItem(ip.Item); Destroy(ip.gameObject); }; ip.OnDispose = () => { _crafter.RemoveItem(ip.Item); Destroy(ip.gameObject); }; ip.Init(); return(true); } AboveText.Show("cannon full", 2, Color.red); return(false); }
void AddItem() { if (crafter.chosenItem == null) { Clear(); } else { item = crafter.chosenItem; image.sprite = item.icon; } crafter.AddItem(this); }