RemoveInventoryItem() public method

public RemoveInventoryItem ( Ingredient ingredient, int count ) : void
ingredient Ingredient
count int
return void
Esempio n. 1
0
        public void OpenTransferModal()
        {
            Inventory     inventory     = UIManager.GetMenu <Inventory>();
            Container     container     = UIManager.GetMenu <Container>();
            TransferModal transferModal = UIManager.GetMenu <TransferModal>();
            int           amount        = 0;

            //TODO remove duplicated code!!
            if (toInventory)
            {
                //we need to add to the inventory
                amount = container.GetIngredientAmount(inventoryIngredient.ingredient);

                if (amount > 5)
                {
                    //open the modal, theres a bunch of things.
                    transferModal = UIManager.GetMenu <TransferModal>();
                    transferModal.Open(amount, inventoryIngredient, toInventory);

                    Close();
                }
                else
                {
                    //we just need to throw one over
                    Debug.Log("container -> inventory");
                    if (amount == 1)
                    {
                        Close();
                    }
                    inventory.AddInventoryItem(inventoryIngredient.ingredient, 1);
                    container.RemoveInventoryItem(inventoryIngredient.ingredient, 1);
                }
            }
            else
            {
                //we need to add to the container
                amount = inventory.GetIngredientAmount(inventoryIngredient.ingredient);

                if (amount > 5)
                {
                    //open the modal, theres a bunch of things.
                    transferModal = UIManager.GetMenu <TransferModal>();
                    transferModal.Open(amount, inventoryIngredient, toInventory);

                    Close();
                }
                else
                {
                    //we just need to throw one over
                    Debug.Log("inventory -> container");
                    if (amount == 1)
                    {
                        Close();
                    }
                    inventory.RemoveInventoryItem(inventoryIngredient.ingredient, 1);
                    container.AddInventoryItem(inventoryIngredient.ingredient, 1);
                }
            }
        }
Esempio n. 2
0
        private void OpenTransferToolTip()
        {
            Inventory inventory = UIManager.GetMenu <Inventory>();
            Container container = UIManager.GetMenu <Container>();

            if (amount > 5)
            {
                //need to pull up a modal
            }
            else
            {
                //throw one over
                inventory.AddInventoryItem(SlotIngredient, 1);
                container.RemoveInventoryItem(SlotIngredient, 1);
            }

            CloseHoverTooltip();
        }
Esempio n. 3
0
        public void Transfer()
        {
            Inventory playerInventory = UIManager.GetMenu <Inventory>();
            Container container       = UIManager.GetMenu <Container>();

            if (toInventory)
            {
                playerInventory.AddInventoryItem(ingredient, Mathf.RoundToInt(slider.value));
                container.RemoveInventoryItem(ingredient, Mathf.RoundToInt(slider.value));
                Close();
            }
            else
            {
                playerInventory.RemoveInventoryItem(ingredient, Mathf.RoundToInt(slider.value));
                container.AddInventoryItem(ingredient, Mathf.RoundToInt(slider.value));
                Close();
            }
        }