Пример #1
0
    // Use this for initialization
    void Start()
    {
        database = GameObject.FindGameObjectWithTag("ItemDatabase").GetComponent<ItemDatabase>();
        // toolTip = GameObject.FindGameObjectWithTag("ToolTip").GetComponent<GameObject>();
        //draggedItemGameObject = GameObject.FindGameObjectWithTag("droppedItemIcon").GetComponent<GameObject>();

        for (int i = 0; i < 0; i++)
        {
            for (int k = 0; k < 0; k++)
            {
                GameObject slot = (GameObject)Instantiate(slots);
                slot.GetComponent<SlotScript>().slotNumber = slotAmount;
                Slots.Add(slot);
                //Items.Add(new Item());
                slot.transform.parent = this.gameObject.transform;
                slot.name = "slot" + i + "." + k;
                slot.GetComponent<RectTransform>().localScale = new Vector3(1, 1, 1);
                slot.GetComponent<RectTransform>().localPosition = new Vector3(x, y, 0);
                x = x + 105;
                if (k == 6)
                {
                    x = -315;
                    y = y - 102;
                }
                slotAmount++;
            }
        }

        for (int i = 0; i < database.size (); i++) {
            addItem (i);
        }

        CharacterSlotInit();
    }