public void OnEquipButton()
    {
        if (GameObject.Find("Equip Button").GetComponentInChildren <Text>().text == "Buy Selected")
        {
            GameObject[] itemButtons = GameObject.FindGameObjectsWithTag("Shop Item Button");
            for (int x = 0; x < 3; x++)
            {
                if (itemButtons[x].GetComponent <Button>().interactable == false)
                {
                    EngineController engine = GameObject.Find("Game Engine").GetComponent <EngineController>();
                    int val = 0;
                    int.TryParse(itemButtons[x].gameObject.name, out val);
                    engine.shopItemBought[val] = true;
                    ShopButtonController temp = itemButtons[x].GetComponent <ShopButtonController>();
                    engine.playerGold -= temp.item.cost;
                    itemButtons[x].SetActive(false);
                    engine.AddItemToBackpack(temp.item);
                    instantiateBackpack();
                    break;
                }
            }
        }
        else
        {
            Item   selectedItem  = null;
            Item[] equippedItems = GameObject.Find("Game Engine").GetComponent <EngineController>().playerEquipment;
            foreach (GameObject b in itemButtons)
            {
                if (!b.GetComponent <Button>().interactable)
                {
                    selectedItem = b.GetComponent <ItemButtonController>().item;
                    int slotNum = 0;
                    switch (b.GetComponent <ItemButtonController>().item.slot)
                    {
                    case Item.Slot.Sword:     //slot 0
                        slotNum = 0;
                        break;

                    case Item.Slot.Head:     //slot 1
                        slotNum = 1;
                        break;

                    case Item.Slot.Chest:     //slot 2
                        slotNum = 2;
                        break;

                    case Item.Slot.Feet:     //slot 3
                        slotNum = 3;
                        break;
                    }
                    if (b.GetComponent <ItemButtonController>().getTextActive())
                    {
                        equippedItems[slotNum] = new Item(equippedItems[slotNum].slot);
                        b.GetComponent <ItemButtonController>().setTextActive(false);
                    }
                    else
                    {
                        equippedItems[slotNum] = selectedItem;
                        b.GetComponent <ItemButtonController>().setTextActive(true);
                    }
                }
            }
            if (selectedItem == null)
            {
                return;
            }
            foreach (GameObject b in itemButtons)
            {
                if (b.GetComponent <Button>().interactable&& b.GetComponent <ItemButtonController>().item.slot == selectedItem.slot)
                {
                    b.GetComponent <ItemButtonController>().setTextActive(false);
                }
            }
        }
    }