private CraftingDictionairy()
 {
     items = new SortedList <string, List <Item> >();
     items.Add("potatoStick", new List <Item> {
         ItemDictionairy.getItem("potato"), ItemDictionairy.getItem("stick")
     });
 }
 public static Item CheckCrafting(Item[] it)
 {
     for (int j = 0; j < Instance.items.Count; j++)
     {
         bool containsAll = true;
         Debug.Log(Instance.items.Values[j].Count + " + " + it.Length);
         if (Instance.items.Values[j].Count == it.Length)
         {
             List <Item> l = new List <Item>(Instance.items.Values[j]);
             for (int i = 0; i < it.Length; i++)
             {
                 Debug.Log(Instance.items.Values[j].Contains(it[i]));
                 if (l.Contains(it[i]))
                 {
                     l.Remove(it[i]);
                 }
                 else
                 {
                     containsAll = false;
                 }
             }
             if (containsAll)
             {
                 Debug.Log("Found");
                 return(ItemDictionairy.getItem(instance.items.Keys[j]));
             }
         }
     }
     return(null);
 }
Example #3
0
    // Use this for initialization
    void Start()
    {
        itemIcon = gameObject.transform.Find("Item").gameObject;
        if (Random.Range(0.0f, 1.0f) < 0.5)
        {
            holding = ItemDictionairy.getItem("potato");
        }
        else
        {
            holding = ItemDictionairy.getItem("stick");
        }

        inventory = GameObject.Find("Player").GetComponent <Inventory>();
        if (selectSprite == null)
        {
            selectSprite = Resources.Load <Sprite>("Art/ui/Selected");
        }
        if (normalSprite == null)
        {
            normalSprite = Resources.Load <Sprite>("Art/ui/Slot");
        }
    }