示例#1
0
        //用于实现制作CD的
        IEnumerator AddCraftingItem(ItemData itemdata)
        {
            int amount = itemdata.amountToCraft;

            CostIngredients(itemdata.m_CraftingBluePrint.ingredients, amount);
            PlayerInventoryManager.UpdatePlayerCurrency(itemdata.m_CraftingBluePrint.craftingPrices, -1 * amount);
            //Debug.Log(amount);
            for (int i = 0; i < amount; i++)
            {
                StartCD(itemdata.slot, itemdata.m_CraftingBluePrint.craftingTime);
                if (itemdata.m_CraftingBluePrint.CDAllWhenCrafting)
                {
                    AllStartCD(itemdata.m_CraftingBluePrint.craftingTime);
                }

                yield return(new WaitForSeconds(itemdata.m_CraftingBluePrint.craftingTime));

                int chance = Random.Range(0, 100);
                if (chance < itemdata.m_CraftingBluePrint.successChance * 100)
                {
                    Debug.Log("Crafting Success");
                    //废用的,直接加到玩家背包里,他们说不好
                    //playerInventory.AddItem(id);

                    //现在是在指定合成地点掉落
                    Instantiate(Q_GameMaster.Instance.inventoryManager.itemDataBase.getItemByID(itemdata.item.ID).m_object, craftingSpawningPosition.position + spawnOffset, Quaternion.identity);
                    itemdata.inputField.text = (--itemdata.amountToCraft).ToString();
                }


                else
                {
                    Debug.Log("Crafting Failed");
                }
            }

            itemdata.amountToCraft   = 1;
            itemdata.isCrafting      = false;
            itemdata.inputField.text = (itemdata.amountToCraft).ToString();
        }
示例#2
0
        //卖东西
        public void SellItem()
        {
            PlayerInventoryManager.UpdatePlayerCurrency(item.sell_Price, amount);

            ClearItem();
        }
示例#3
0
 void AddCurrency()
 {
     PlayerInventoryManager.UpdatePlayerCurrency(currencyAmounts, 1);
     Destroy(gameObject);
 }
 public static void ChangePlayerCurrency(List <Price> prices, int itemAmount)
 {
     PlayerInventoryManager.UpdatePlayerCurrency(prices, itemAmount);
 }