/// <summary> /// Activate the item currently held in the slot /// </summary> public void UseItem() { if (ItemInSlot != null) { if (ItemCount >= 1) { ItemInSlot.Use(); onItemUse.Invoke(ItemInSlot); ItemCount--; b_needsUpdate = true; } } }
/// <summary> /// Activate the item currently held in the slot /// </summary> // Temporarily removed since it uses left-click public void UseItem(GameObject character) { if (ItemInSlot != null) { if (ItemCount >= 1) { ItemInSlot.Use(character); onItemUse.Invoke(ItemInSlot); ItemCount--; b_needsUpdate = true; } } }
/// <summary> /// Activate the item currently held in the slot /// </summary> public void UseItem() ///Where Magic Happens. { if (ItemInSlot == null) { //Debug.Log("Here"); if (!outputslot) // If its Not an Output Slot Then do this. { if (PlayerCharacter.GetComponent <GrabnGo>().grabbed == true) // Are we Grabbing any thing? { SetContents(PlayerCharacter.GetComponent <Inventory>().masterItemTable.GetItem(PlayerCharacter.GetComponent <GrabnGo>().item), 1); //Then Set THe contents. PlayerCharacter.GetComponent <GrabnGo>().grabbed = false; //Now that we have set Everything We turn that to False. Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); // Setting our Cursor to Nothing. ItemCount = 1; b_needsUpdate = true; if (PlayerCharacter.GetComponent <GrabnGo>().grabbedOutput) // Are We grabbing output? { GameObject[] gameObject = GameObject.FindGameObjectsWithTag("ItemSlotCrafting"); // Lets go the Crafting Table. foreach (var item in gameObject) { item.SendMessage("ClearSlot"); } PlayerCharacter.GetComponent <GrabnGo>().grabbedOutput = false; } craftingTraversal(); //Run this Method. return; } } } if (ItemInSlot != null) { if (ItemCount >= 1) { Debug.Log("CraftHere"); ItemInSlot.Use(); // First er use the Item. onItemUse.Invoke(ItemInSlot); //Invoke On ITem Use. ItemCount--; b_needsUpdate = true; } } }