Beispiel #1
0
    void setUpPiecesColor(int axe, int frame, Color faceColor)
    {
        List <GameObject> framePieces = getFramePieces(axe, frame);
        bool reverse = (frame == 2);

        foreach (var item in framePieces)
        {
            CubePieceBuilder pieceScpt = item.GetComponent <CubePieceBuilder>();
            if (axe == x)
            {
                pieceScpt.xColor   = faceColor;
                pieceScpt.reverseX = reverse;
            }
            else if (axe == y)
            {
                pieceScpt.yColor   = faceColor;
                pieceScpt.reverseY = reverse;
            }
            else if (axe == z)
            {
                pieceScpt.zColor   = faceColor;
                pieceScpt.reverseZ = reverse;
            }
        }
    }
Beispiel #2
0
    int getPieceFrame(int rotAxe)
    {
        CubePieceBuilder pieceScript = actualClickedPiece.GetComponent <CubePieceBuilder>();

        if (rotAxe == 0)
        {
            return(((int)Mathf.Round(actualClickedPiece.transform.position.x / (pieceScript.size)) - 1) * (-1));
        }
        else if (rotAxe == 1)
        {
            return((int)(Mathf.Round(actualClickedPiece.transform.position.y / (pieceScript.size)) - 1) * (-1));
        }
        else
        {
            return((int)(Mathf.Round(actualClickedPiece.transform.position.z / (pieceScript.size)) - 1) * (-1));
        }
    }
Beispiel #3
0
    void setUpPieces()
    {
        int m = 0;

        for (int i = -1; i < 2; i++)
        {
            for (int j = -1; j < 2; j++)
            {
                for (int k = -1; k < 2; k++)
                {
                    pieces[m].transform.position = new Vector3(i * size, j * size, k * size);
                    CubePieceBuilder pieceScript = pieces[m].GetComponent <CubePieceBuilder>();
                    pieceScript.size       = size;
                    pieceScript.borderSize = borderSize;
                    m++;
                }
            }
        }
    }