示例#1
0
    public void AttemptMix()
    {
        for (int i = 0; i < itemsNeededForMix.Count; i++)
        {
            bool found = false;
            if (i + 1 > itemsInMixer.Count)
            {
                foreach (ClickableItem item in itemsInMixer)
                {
                    inventory.AddInventoryItem(item);
                }
                for (int j = itemsInMixer.Count - 1; 0 < itemsInMixer.Count; --j)
                {
                    itemsInMixer[j] = null;
                    itemsInMixer.RemoveAt(j);
                }
                shouldMix = true;
                return;
            }

            if (itemsInMixer[i].ItemName == itemsNeededForMix[i].ItemName)
            {
                Debug.Log("shouldbefound" + itemsInMixer[i].ItemName);
                found = true;
            }
            Debug.Log(found);
            if (!found)
            {
                shouldMix = false;
            }
            Debug.Log(shouldMix);
        }
        if (shouldMix)
        {
            GlobalEvents.Invoke(new WinEvent());
        }
        else
        {
            foreach (ClickableItem item in itemsInMixer)
            {
                inventory.AddInventoryItem(item);
            }
            for (int i = itemsInMixer.Count - 1; 0 < itemsInMixer.Count; --i)
            {
                Debug.Log("remove item = " + i);
                itemsInMixer[i] = null;
                itemsInMixer.RemoveAt(i);
            }
        }
        shouldMix = true;
    }
 protected override void OnClick()
 {
     base.OnClick();
     if (!shouldNotAdd)
     {
         inventory.AddInventoryItem(this);
     }
 }
 private void RecipeCounter(RecipeEvent evt)
 {
     recipies++;
     Debug.Log(recipies + "Amount of");
     if (recipies == 4)
     {
         inventory.AddInventoryItem(clickableitem);
     }
 }
 private void plantIsCut(CutPlantEvent evt)
 {
     inventory.AddInventoryItem(pepperItem);
     Debug.Log("lmooei");
 }