private void UpdateFaceColors()
        {
            Vector3[] faces = new Vector3[] { new Vector3(-1, 2, -1), new Vector3(-1, 0, -1),
                                              new Vector3(-1, -1, 0), new Vector3(-1, -1, 2), new Vector3(0, -1, -1), new Vector3(2, -1, -1) };

            isSolved = true;
            for (int i = 0; i < 6; i++)
            {
                Color[,] faceColors = cube.GetFaceColors(faces[i]);

                for (int y = 0; isSolved && y < faceColors.GetLength(0); y++)
                {
                    for (int x = 0; isSolved && x < faceColors.GetLength(1); x++)
                    {
                        if (x != 0 || y != 0)
                        {
                            isSolved = faceColors[x, y] == faceColors[0, 0];
                        }
                    }
                }

                if (faceColors[1, 1] == Color.White)
                {
                    whiteFace = faceColors;
                }
                if (faceColors[1, 1] == Color.Yellow)
                {
                    yellowFace = faceColors;
                }
                if (faceColors[1, 1] == Color.Red)
                {
                    redFace = faceColors;
                }
                if (faceColors[1, 1] == Color.Orange)
                {
                    orangeFace = faceColors;
                }
                if (faceColors[1, 1] == Color.Blue)
                {
                    blueFace = faceColors;
                }
                if (faceColors[1, 1] == Color.Green)
                {
                    greenFace = faceColors;
                }
            }
        }
Beispiel #2
0
        private void Draw2DCube()
        {
            int x    = 50;
            int y    = 700;
            int size = cube.CubeSize * largePixel.Width + 3;

            DrawGrid(cube.GetFaceColors(new Vector3(-1, -1, 0)), new Vector2(x + size, y + size));      // Front
            DrawGrid(cube.GetFaceColors(new Vector3(2, -1, -1)), new Vector2(x, y + size));             // Left
            DrawGrid(cube.GetFaceColors(new Vector3(0, -1, -1)), new Vector2(x + 2 * size, y + size));  // Right
            DrawGrid(cube.GetFaceColors(new Vector3(-1, 2, -1)), new Vector2(x + size, y));             // Top
            DrawGrid(cube.GetFaceColors(new Vector3(-1, 0, -1)), new Vector2(x + size, y + 2 * size));  // Bottom
            DrawGrid(cube.GetFaceColors(new Vector3(-1, -1, 2)), new Vector2(x + 3 * size, y + size));  // Back
        }