Exemplo n.º 1
0
    void rotateClamp()
    {
        if (centerCube == null)
        {
            return;
        }

        int direction = 0;
        int up        = 0;

        if (centerCube.blockedLeft())
        {
            direction = 1;
        }
        if (centerCube.blockedRight())
        {
            direction = -1;
        }
        if (centerCube.blockedDown())
        {
            up = 1;
        }

        if (orangeCenterCube2 != null)
        {
            if (orangeCenterCube2.blockedLeft())
            {
                direction = 1;
            }
            if (orangeCenterCube2.blockedRight())
            {
                direction = -1;
            }
            if (orangeCenterCube2.blockedDown())
            {
                up = 1;
            }
        }

//		Debug.Log ("(" + direction + ", " + up + ")");
        transform.Translate(direction, up, 0, Space.World);
        if (undo() && gameObject.name[0] == 'I')         // 'I' piece can move 2 spaces for clamp
        {
            transform.Translate(direction, up, 0, Space.World);
        }

        checkBlocked();
    }