public void checkPress()
    {
        if (isPositioning)
        {
            hideButtons();

            string name = ElementPlacing.truncateNumbers(placedElem.name);

            if (ep.getObjectNum(name) < transform.GetComponent <InvOpen>().panel.GetComponent <AvailElemManager>().getCount(name))
            {
                ElementPlacing.currHold = ElementPlacing.truncateNumbers(placedElem.name);
                ElementPlacing.holding  = true;
            }

            if (!PlaySimulation.isSimActive)
            {
                if (placedElem.name.Contains("ramp"))
                {
                    BlockHover.showRampGrid();
                }
                else
                {
                    BlockHover.showGrid();
                }
            }
            //BlockHover.hideRampGrid ();
            ep.canPlace = true;
            placedElem  = null;
        }
    }
    // Update is called once per frame
    void Update()
    {
        foreach (AvailElement ae in availElements)
        {
            GameObject elem = GameObject.Find(ae.type + "(Clone)");

            if (ep.getObjectNum(ae.type) < ae.count)
            {
                if (elem == null)
                {
                    switch (ae.type)
                    {
                    case "block":
                        elem = block;
                        break;

                    case "setdir":
                        elem = setdir;
                        break;

                    case "ramp":
                        elem = ramp;
                        break;

                    case "curve":
                        elem = curve;
                        break;

                    case "pistonblock":
                        elem = pistonBlock;
                        break;
                    }

                    GameObject newElem = Instantiate(elem) as GameObject;
                    newElem.transform.SetParent(GameObject.Find("Buttons").transform, false);
                    newElem.GetComponent <Button> ().onClick.AddListener(delegate { GameObject.Find("Placing").GetComponent <ElementPlacing>().TakeElement(ae.type); });
                    elem = newElem;
                }


                elem.transform.GetChild(0).GetComponent <Text> ().text = "x" + (ae.count - ep.getObjectNum(ae.type));
            }
            else
            {
                if (elem)
                {
                    Destroy(GameObject.Find(ae.go.name + "(Clone)"));

                    ElementPlacing.holding = false;
                    BlockHover.hideGrid();
                    BlockHover.hideRampGrid();
                }
            }
        }
    }