Exemplo n.º 1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0) && message.activeInHierarchy && dragged == null)
        {
            dragged = this;
            myImage.raycastTarget = false;
        }

        if (dragged == this)
        {
            this.transform.position = Input.mousePosition;
            if (Input.GetMouseButtonUp(0))
            {
                if (target != null)
                {
                    int newIndex = target.transform.GetSiblingIndex();
                    target.transform.SetSiblingIndex(this.transform.GetSiblingIndex());
                    this.transform.SetSiblingIndex(newIndex);
                    target.myImage.color = Color.clear;
                    target = null;
                }
                dragged = null;
                myImage.raycastTarget = true;
            }
        }
    }
Exemplo n.º 2
0
    public void AddItem(ItemPuzzle item)
    {
        MinItemP temp = Instantiate(genItem, itemTab).GetComponent <MinItemP>();

        //temp.GetComponent<Image>().sprite = item.art;
        temp.gameObject.SetActive(true);
        temp.transform.GetChild(0).GetComponent <Text>().text = item.info.title;
        items.Add(temp);
    }