public void CraftRecipe1() { if ((craftingRecipeNew.craftingRecipesNew[0].itemObject[0].Id == craftingTable.Container.Slots[0].item.Id || craftingRecipeNew.craftingRecipesNew[0].itemObject[1].Id == craftingTable.Container.Slots[0].item.Id || craftingRecipeNew.craftingRecipesNew[0].itemObject[2].Id == craftingTable.Container.Slots[0].item.Id) && (craftingRecipeNew.craftingRecipesNew[0].itemObject[0].Id == craftingTable.Container.Slots[1].item.Id || craftingRecipeNew.craftingRecipesNew[0].itemObject[1].Id == craftingTable.Container.Slots[1].item.Id || craftingRecipeNew.craftingRecipesNew[0].itemObject[2].Id == craftingTable.Container.Slots[1].item.Id) && (craftingRecipeNew.craftingRecipesNew[0].itemObject[0].Id == craftingTable.Container.Slots[2].item.Id || craftingRecipeNew.craftingRecipesNew[0].itemObject[1].Id == craftingTable.Container.Slots[2].item.Id || craftingRecipeNew.craftingRecipesNew[0].itemObject[2].Id == craftingTable.Container.Slots[2].item.Id)) { Item _item = new Item(craftingRecipeNew.craftingRecipesNew[0].result); craftButton.SetActive(true); if (craftingOutput1 == true) { if (inventory.AddItems(_item, 1)) { for (int i = 0; i < craftingTable.Container.Slots.Length; i++) { craftingTable.Container.Slots[i].RemoveItem(); craftingOutput1 = false; craftButton.SetActive(false); } } } } }
public void OnTriggerStay(Collider other) { pressEToOpen.SetActive(true); var item = other.GetComponent <GroundItem>(); if (item && Input.GetKey(KeyCode.E)) { Item _item = new Item(item.item); if (inventory.AddItems(_item, 1)) { pressEToOpen.SetActive(false); Destroy(other.gameObject); } } }