Ejemplo n.º 1
0
    void getFourByFourSquares()
    {
        try
        {
            for (int i = 0; i < gridArray.gridX; i++)//search through array to find current block then get right, top and top right block to fill 4x4 placement space.
            {
                for (int n = 0; n < gridArray.gridY; n++)
                {
                    if (gameObject.name == "grid:" + i + "," + n)
                    {
                        int posX = i + 1;
                        int posY = n + 1;

                        squareTop      = GameObject.Find("grid:" + i + "," + posY);
                        squareRight    = GameObject.Find("grid:" + posX + "," + n);
                        squareTopRight = GameObject.Find("grid:" + posX + "," + posY);

                        mainStatus     = GetComponent <squareStatus>();
                        topStatus      = squareTop.GetComponent <squareStatus>();
                        rightStatus    = squareRight.GetComponent <squareStatus>();
                        topRightStatus = squareTopRight.GetComponent <squareStatus>();
                    }
                }
            }
        }
        catch (Exception e)
        {
        }
    }
Ejemplo n.º 2
0
    public void resetChildren()
    {
        squareStatus mainStatus     = GetComponentInParent <squareStatus>();
        squareStatus topStatus      = childTop.GetComponent <squareStatus>();
        squareStatus rightStatus    = childRight.GetComponent <squareStatus>();
        squareStatus topRightStatus = childTopRight.GetComponent <squareStatus>();

        mainStatus.resetSquare();
        topStatus.resetSquare();
        rightStatus.resetSquare();
        topRightStatus.resetSquare();
        squareRight.transform.parent    = this.transform.parent;
        squareTop.transform.parent      = this.transform.parent;
        squareTopRight.transform.parent = this.transform.parent;
    }