public void OnCraftButtonClick()
 {
     if (craftingRecipe != null && ItemContainer != null)
     {
         craftingRecipe.Craft(ItemContainer);
     }
 }
Beispiel #2
0
 public void CraftItem()
 {
     //iCraft.ItemCounter(essence);
     //iCraft.ItemCounter(crystals);
     //iCraft.ItemCounter(database);
     craft.CanCraft(iCraft);
     craft.Craft(iCraft);
 }
Beispiel #3
0
 public void OnCraftButtonClick()
 {
     Debug.Log("button pressed");
     if (craftingRecipe != null && ItemContainer != null)
     {
         craftingRecipe.Craft(ItemContainer);
     }
 }
Beispiel #4
0
    public void OnCraftButtonClick()
    {
        craftingRecipe.Craft(itemContainer);

        if (craftingRecipe.HasMaterials(itemContainer) == false)
        {
            StartCoroutine(NotEnoughMaterials());
        }
    }
 private void craft()
 {
     item = Instantiate(CraftRec.Craft()) as GameObject;
     item.transform.position = holder.transform.position;
     item.transform.rotation = gameObject.transform.rotation;
     item.GetComponent <Rigidbody>().isKinematic = true;
     item.GetComponent <Collider>().enabled      = true;
     item.tag = "item";
     holding  = true;
 }
    private void Update()
    {
        if (!playerManager.uISelection)
        {
            recipeListUI.color = recipeTitleUI.color = recipeDetailUI.color = Color.black;
            //getting scroll input
            var up    = Input.GetKeyDown(KeyCode.W);
            var down  = Input.GetKeyDown(KeyCode.S);
            var eDown = Input.GetKeyDown(KeyCode.E);

            //adjusting UI accordingly
            if (up && recipes.Count > 1)
            {
                positionInList -= 1;
                if (positionInList < 0)
                {
                    positionInList = recipes.Count - 1;
                }
                UpdateUI();
            }
            if (down && recipes.Count > 1)
            {
                positionInList += 1;
                if (positionInList > recipes.Count - 1)
                {
                    positionInList = 0;
                }
                UpdateUI();
            }
            if (eDown)
            {
                bool isCraftable = true;

                foreach (Item requiredItem in recipeSelected.requiredItems)
                {
                    Item item = playerManager.inventory.Find(x => x.itemName == requiredItem.itemName);
                    if (item == null || item.quantity < recipeSelected.quantityOfRequredItem)
                    {
                        isCraftable = false;
                        Debug.Log("missing items or incorrect quantity.");
                    }
                }
                if (isCraftable)
                {
                    recipeSelected.Craft(playerManager);
                    FindObjectOfType <InventoryUI>().UpdateUI();
                }
            }
        }
        else
        {
            recipeListUI.color = recipeTitleUI.color = recipeDetailUI.color = Color.grey;
        }
    }
Beispiel #7
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         inventory.AddItem(item);
     }
     if (Input.GetKeyDown(KeyCode.C))
     {
         recipe.Craft(inventory);
     }
 }
Beispiel #8
0
    public override void CallEvent(GameObject interactor = null)
    {
        if (interactor)
        {
            if (interactor.GetComponent <PlayerInventory>())
            {
                PlayerInventory inventory = interactor.GetComponent <PlayerInventory>();

                inventory.AddItem(recipe.Craft(inventory), recipe.amount);
            }
        }
    }
    public override void CallEvent(GameObject interactor = null)
    {
        if (interactor && isRepaired)
        {
            if (interactor.GetComponent <PlayerInventory>())
            {
                PlayerInventory inventory = interactor.GetComponent <PlayerInventory>();

                if (recipe.Craft(inventory) != null)
                {
                    Debug.Log("Machine started crafting!");
                    crafted    = true;
                    craftTimer = craftTime;
                }
            }
        }
    }
Beispiel #10
0
 private void Craft(CraftingRecipe craftingRecipe)
 {
     if (!inventory.IsFull())
     {
         if (craftingRecipe.CanCraft(inventory))
         {
             craftingRecipe.Craft(inventory);
         }
         else
         {
             Debug.Log("Required Items Not Reachable");
         }
     }
     else
     {
         Debug.Log("inventory is full");
     }
 }
 public void OnCraftButtonClick()
 {
     if (craftingRecipe != null && ItemContainer != null)
     {
         if (craftingRecipe.CanCraft(ItemContainer))
         {
             if (!ItemContainer.IsFull())
             {
                 craftingRecipe.Craft(ItemContainer);
             }
             else
             {
                 Debug.LogError("Iventory is full");
             }
         }
         else
         {
             Debug.LogError("Not enough materials");
         }
     }
 }
Beispiel #12
0
 public void OnCraftButtonClick()
 {
     if (craftingRecipe != null && ItemContainer != null)
     {
         if (craftingRecipe.CanCraft(ItemContainer))
         {
             if (!ItemContainer.IsFull())
             {
                 craftingRecipe.Craft(ItemContainer);
             }
             else
             {
                 Debug.LogError("Inventory is full");
             }
         }
         else
         {
             Debug.LogError("You dont have to required materials!");
         }
     }
 }
Beispiel #13
0
 public void OnCraftButtonClick()
 {
     if (craftingRecipe != null && itemContainer != null)
     {
         if (craftingRecipe.CanCraft(itemContainer))
         {
             if (!itemContainer.IsFull())
             {
                 craftingRecipe.Craft(itemContainer);
             }
             else
             {
                 Debug.Log("inventory is full.");
             }
         }
         else
         {
             FindObjectOfType <AudioManager>().Play("CantCraft"); //CANT CRAFT SOUND
             StartCoroutine(NotEnoughMaterials());
         }
     }
 }
Beispiel #14
0
 public void OnCraftButtonClick(CraftingRecipe recipe)
 {
     recipe.Craft(Equipment, HubChest);
     UpdateAllCraftingRecipes();
 }
 public void OnCraftButtonClick()
 {
     craftingRecipe.Craft(ItemContainer);
 }
 public void Craft()
 {
     RecipeToCraft.Craft();
 }