예제 #1
0
    //Scramble
    public void Scramble(int length = 25)
    {
        Color[]             sides  = new Color[] { Color.white, Color.green, Color.red, Color.blue, Color.Lerp(Color.yellow, Color.red, 0.5F), Color.yellow };
        List <(Color, int)> output = new List <(Color, int)>();

        for (int i = 0; i < length; i++)
        {
            int index    = Mathf.RoundToInt(UnityEngine.Random.Range(0, sides.Length - 1));
            int rotation = Mathf.RoundToInt(UnityEngine.Random.Range(-3, 3));
            while (rotation == 0)
            {
                rotation = Mathf.RoundToInt(UnityEngine.Random.Range(-3, 3));
            }
            cube.Rotate(sides[index], rotation, ref output);
        }

        scramble.text = cube.RotationsToString(output);
        visualizer.UpdateVisualization();
    }