Пример #1
0
    void Start()
    {
        Instance = this;

        possibleItemsCanvas  = GetComponent <Canvas>();
        possibleItemsButtons = (RectTransform)transform.Find("Buttons");
    }
Пример #2
0
    public static void DeterminePossibleItems(bool craftingMenuOpen)
    {
        //loop thru allItems list, if an item's requiremnts list is the same length and
        //contains the same elements as the currentlyCrafting list add it to possibleItems list

        foreach (Item item in allItemsCopy)
        {
            Debug.Log("currently crafting length: " + Inventory.currentlyCrafting.Count);
            if (Inventory.currentlyCrafting.Count == item.requirements.Count)
            {
                bool noMatch = false;
                foreach (string req in Inventory.currentlyCrafting)
                {
                    Debug.Log("Current Craft: " + req + " present? " + item.requirements.Contains(req));
                    if (!item.requirements.Contains(req))
                    {
                        noMatch = true;
                    }
                }

                if (!noMatch)
                {
                    if (!Crafting.possibleItems.Contains(item))
                    {
                        Crafting.possibleItems.Add(item);
                    }
                }
            }
        }

        Debug.Log("Current Possible Items: " + possibleItems.Count);

        if (!craftingMenuOpen)
        {
            PossibleItemsMenu.ShowItems();
        }
        else
        {
            CraftingMenu.ShowResults();
        }
    }
Пример #3
0
    void OnTriggerExit2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            Debug.Log("Resource Out Range");
            Crafting.resourceInRange = false;
            Inventory.currentlyCrafting.Clear();

            if (resourceMenu.interactCanvas.enabled)
            {
                resourceMenu.interactCanvas.enabled = false;
                resourceMenu.ResetInteractCanvas();
            }

            if (PossibleItemsMenu.possibleItemsCanvas.enabled)
            {
                PossibleItemsMenu.possibleItemsCanvas.enabled = false;
                PossibleItemsMenu.ClearItems();
            }
        }
    }