Beispiel #1
0
    //Method to make an item visible and enable its scripts
    public void EnableItem(int index)
    {
        //    Debug.Log("Enabling " + items[index]);

        //Get the item from the array
        if (items[index] != null)
        {
            Item selectedItem = items[index];

            _heldItem = selectedItem;

            if (selectedItem.IsCollected())
            {
                selectedItem.ToggleObject(true);

                ////Enable the item's renderers
                //selectedItem.ToggleRenderers(true);

                ////Enable the item's scripts
                //selectedItem.ToggleScripts(true);
            }

            if (selectedItem.itemObj.tag == "Notepad")
            {
                Notepad_Manager _notepadScript = selectedItem.itemObj.GetComponent <Notepad_Manager>();
                _notepadScript.ToggleCanvas(true);
            }
        }
    }
Beispiel #2
0
    //Method to visually & scriptually (is this a word?) disable all items
    public void DisableItems()
    {
        _heldItem = null;

        foreach (Item item in items)
        {
            if (item.IsCollected())
            {
                ////Disable all renderers
                //item.ToggleRenderers(false);

                //item.ToggleScripts(false);

                //Disable all objects
                item.ToggleObject(false);

                if (item.itemObj.tag == "Notepad")
                {
                    Notepad_Manager _notepadScript = item.itemObj.GetComponent <Notepad_Manager>();
                    _notepadScript.ToggleCanvas(false);
                }
            }
        }
    }