Exemplo n.º 1
0
    bool CheckNode(InventoryGridNode inventoryGridNode)
    {
        if (inventoryGridNode == null)
        {
            return(false);
        }
        if (inventoryGridNode.Contents == null)
        {
            return(true);
        }

        else
        {
            return(false);
        }
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        float         allWidth  = tileWidth * Columns;
        float         allHeight = tileHeight * Rows;
        RectTransform rt        = GetComponent <RectTransform>();

        rt.sizeDelta = new Vector2(allWidth + borderWidth, allHeight + borderWidth);
        for (int r = 1; r <= Rows; r++)
        {
            for (int c = 1; c <= Columns; c++)
            {
                GameObject tempGO = GameObject.Instantiate(tilePrefab, Holder);
                tempGO.name = c + "," + r;
                RectTransform rtTemp = tempGO.GetComponent <RectTransform>();
                rtTemp.localPosition = new Vector2((tileWidth * (c - 1) - allWidth / 2), (allHeight / 2 - (tileHeight * (r - 1))));
                InventoryGridNode IGNScript = tempGO.GetComponent <InventoryGridNode>();
                IGNScript.Column = c;
                IGNScript.Row    = r;
                IGNScript.Grid   = gameObject;
                AllTiles.Add(IGNScript);
                GetComponent <InventoryMenu>().UIElements.Add(tempGO);
            }
        }
    }