private void GolemGrab()
    {
        //Debug.Log("Casting Ray");
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        Debug.DrawLine(ray.origin, ray.direction, Color.green);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 40))
        {
            //If a golem
            if (hit.transform.gameObject.CompareTag("Golem") && pickedupGolem == null)
            {
                //If not holding a pouch
                if (!hit.transform.gameObject.GetComponent <ShonkyWander>().IsHoldingPouch())
                {
                    GameManager.pickedUpGolem = true;
                    pickedupGolem             = hit.transform.gameObject;
                    HoldGolem(hit);
                }
                else
                {
                    //If room in the inventory, add the pouch
                    int pouchSlot = Inventory.Instance.InsertItem(pouch);
                    pickedupGolem = hit.transform.gameObject;
                    int golemIndex = GetGolemSlot();
                    if (pouchSlot > -1)
                    {
                        //Reset golem and set pouch to inventory
                        SFX.Play("Golem Exclaim Voices", 1f, 1f, 0f, false, 0f);
                        hit.transform.gameObject.GetComponent <ShonkyWander>().RemovePouch();
                        Slot insertedSlot;
                        if (!GameManager.Instance.InTutorial)
                        {
                            insertedSlot = inv.GetSlotAtIndex(pouchSlot);
                        }
                        else
                        {
                            insertedSlot = tutInv.GetSlotAtIndex(pouchSlot);
                        }

                        insertedSlot.SetItem(pouch);

                        //Get gemtype from golem and apply to pouch
                        ItemInstance instance;
                        if (ShonkyInventory.Instance.GetItem(golemIndex, out instance))
                        {
                            Item.GemType bagType = instance.pouchType;
                            ItemInstance inst;
                            if (Inventory.Instance.GetItem(pouchSlot, out inst))
                            {
                                inst.pouchType = bagType;
                            }
                        }

                        //Change pouch colour according to Gem
                        GameObject obj;
                        if (insertedSlot.GetPrefabInstance(out obj))
                        {
                            obj.GetComponent <SackHueChange>().UpdateCurrentColor(instance.pouchType);
                        }

                        if (GameManager.Instance.InTutorial && !GameManager.Instance.MineGoleminteractGolem)
                        {
                            if (GameManager.Instance.ReturnPouch)
                            {
                                tutManager.NextInstruction();
                                tutShonkyInv.RemoveSpecificRune(pickedupGolem);
                                GameManager.Instance.ReturnPouch            = false;
                                GameManager.Instance.MineGoleminteractGolem = true;
                                RemovePortalRune();
                                Camera.main.GetComponent <CameraTap>().HighlightButton();
                            }
                        }

                        //Move pouch to slot from golem position
                        GameObject newPouch = insertedSlot.prefabInstance;
                        newPouch.transform.position = pickedupGolem.transform.position;

                        Vector3 midwayPos = (Camera.main.transform.position + newPouch.transform.position) / 2;
                        newPouch.transform.DOMove(midwayPos, 1f, false).SetEase(Ease.OutBack).OnComplete(() =>
                                                                                                         newPouch.transform.DOMove(insertedSlot.transform.position, 2f, false)
                                                                                                         .SetEase(Ease.OutBack));
                        pickedupGolem = null;
                    }
                    else
                    {
                        HoldGolem(hit);
                    }
                }
            }
            else if (pickedupGolem != null)
            {
                //Debug.Log("Calling hold golem");
                HoldGolem();
            }
            else if (Mine.Instance.ReadyToCollect() && hit.transform.gameObject.CompareTag("PortalEntry") &&
                     pickedupGolem == null)
            {
                //Stop Sound
                SFX.StopSpecific("Mine_portal_fini");

                golems = null;
                golems = Mine.Instance.ReturnReadyGolems();
                foreach (int golem in golems)
                {
                    ReturnGolem(golem);
                }
            }
        }
        else if (pickedupGolem != null)
        {
            HoldGolem();
        }
    }
    private void GolemGrab()
    {
        //Debug.Log("Casting Ray");
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        //Do an accuracy check before hand to ensure one isn't picked up and floating away
        holding = CheckAccuracy();
        if (!holding)
        {
            ResetGolem();
        }

        if (Physics.Raycast(ray, out hit, 20))
        {
            //If a golem
            if (hit.transform.gameObject.tag == "Golem")
            {
                //Check we don't currently have another golem held, if so reset it
                if (pickedupGolem != null && pickedupGolem != hit.transform.gameObject)
                {
                    Debug.Log("Reseting golem");
                    ResetGolem();
                }
                else
                {
                    //If not holding a pouch
                    if (!hit.transform.gameObject.GetComponent <ShonkyWander>().IsHoldingPouch())
                    {
                        GameManager.pickedUpGolem = true;
                        pickedupGolem             = hit.transform.gameObject;
                        HoldGolem(hit);
                    }
                    else
                    {
                        //If room in the inventory, add the pouch
                        int pouchSlot = Inventory.Instance.InsertItem(pouch);
                        pickedupGolem = hit.transform.gameObject;
                        int golemIndex = GetGolemSlot();
                        if (pouchSlot > -1)
                        {
                            //Reset golem and set pouch to inventory
                            //SFX.Play("sound");
                            hit.transform.gameObject.GetComponent <ShonkyWander>().RemovePouch();
                            Slot insertedSlot = inv.GetSlotAtIndex(pouchSlot);
                            insertedSlot.SetItem(pouch);

                            //Get gemtype from golem and apply to pouch
                            ItemInstance instance;
                            if (ShonkyInventory.Instance.GetItem(golemIndex, out instance))
                            {
                                Item.GemType bagType = instance.pouchType;
                                ItemInstance inst;
                                if (Inventory.Instance.GetItem(pouchSlot, out inst))
                                {
                                    inst.pouchType = bagType;
                                }
                            }

                            //Change pouch colour according to Gem
                            GameObject obj;
                            if (insertedSlot.GetPrefabInstance(out obj))
                            {
                                obj.GetComponent <SackHueChange>().UpdateCurrentColor(instance.pouchType);
                            }

                            ResetGolem();
                        }
                        else
                        {
                            //SFX.Play("sound");
                        }
                    }
                }
            }
            else if (Mine.Instance.ReadyToCollect() && hit.transform.gameObject.CompareTag("PortalEntry") &&
                     pickedupGolem == null)
            {
                golems = null;
                golems = Mine.Instance.ReturnReadyGolems();
                foreach (int golem in golems)
                {
                    ReturnGolem(golem);
                }
            }
            else
            {
                ResetGolem();
            }
        }
    }
    private void ResourcePouchOpen(Slot slot)
    {
        // Hard coded for now.  To do this dynamically, maybe put <names,chances> in a dictionary<string, float>.
        float gemChance = 0.4f,
              oreChance = 1.00f;
        int numberItems = Random.Range(1, 5);

        //SFX.Play("sound");
        SFX.Play("Res_pouch_open", 1f, 1f, 0f, false, 0f);
        AchievementManager.Get("pouch_open_01");

        var drops = new List <ItemInstance>();

        for (int i = 0; i < numberItems; i++)
        {
            string dropName;
            string gem = DetermineGemToDrop(slot);
            Debug.Log("Gemtype to drop is " + gem);
            float spin = Random.Range(0, 1f);
            if (spin < gemChance)
            {
                dropName = gem;
            }
            else if (spin < oreChance)
            {
                dropName = "Ore";
                //This was for testing and it does drop the correct gems
                //dropName = DetermineGemToDrop();
            }
            else
            {
                dropName = null;
            }

            // Item is not new for now.
            if (dropName != null)
            {
                drops.Add(new ItemInstance(dropName, 1, Quality.QualityGrade.Unset, false));
            }
        }

        Inventory inv = Inventory.Instance;

        slot.RemoveItem();
        inv.RemoveItem(slot.index);

        foreach (ItemInstance drop in drops)
        {
            int pos = inv.InsertItem(drop);
            // If found a slot to place item.
            if (pos != -1)
            {
                Slot       toSlot = physicalInventory.GetSlotAtIndex(pos);
                GameObject clone  = Instantiate(drop.item.physicalRepresentation, slot.transform.position, slot.transform.rotation);

                // Kind of a placeholder animation.
                // TODO: randomize the Vector3.up a little so that the items separate when they go up.
                clone.transform.DOMove(clone.transform.position + Vector3.up, 0.7f).SetEase(Ease.OutBack)
                .OnComplete(() => clone.transform.DOMove(toSlot.transform.position + Vector3.up, 0.6f).SetEase(Ease.OutBack)
                            .OnComplete(() => clone.transform.DOMove(toSlot.transform.position, 1f).SetEase(Ease.OutBounce)));

                toSlot.SetItemInstantiated(drop, clone);
            }
        }
    }