Esempio n. 1
0
 public string findCurrentStage(string status)
 {
     if (cubeStatus.isFinished(status))
     {
         return("Finished");
     }
     else
     {
         if (hasCross(status))
         {
             if (hasF1L(status))
             {
                 if (hasF2L(status))
                 {
                     if (hasTop(status))
                     {
                         return("PLL");
                     }
                     return("OLL");
                 }
                 return("F2L");
             }
             return("F1L");
         }
         return("Cross");
     }
 }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (root != null)
     {
         if (shouldDestroy)
         {
             if (root.childCount > 0)
             {
                 for (int i = 0; i < root.childCount; i++)
                 {
                     root.GetChild(i).SetParent(rootCube);
                 }
             }
             else
             {
                 Destroy(root.gameObject);
                 root          = null;
                 shouldDestroy = false;
             }
         }
         else
         {
             root.Rotate(rotation);
             rotation_sum += rotation.magnitude;
             if (rotation_sum >= 90)
             {
                 rotation_sum = 0;
                 if (rotation.x != 0)
                 {
                     if (rotation.x < 0)
                     {
                         root.eulerAngles = new Vector3(-90, root.eulerAngles.y, root.eulerAngles.z);
                     }
                     else
                     {
                         root.eulerAngles = new Vector3(90, root.eulerAngles.y, root.eulerAngles.z);
                     }
                 }
                 else if (rotation.y != 0)
                 {
                     if (rotation.y < 0)
                     {
                         root.eulerAngles = new Vector3(root.eulerAngles.x, -90, root.eulerAngles.z);
                     }
                     else
                     {
                         root.eulerAngles = new Vector3(root.eulerAngles.x, 90, root.eulerAngles.z);
                     }
                 }
                 else
                 {
                     if (rotation.z < 0)
                     {
                         root.eulerAngles = new Vector3(root.eulerAngles.x, root.eulerAngles.y, -90);
                     }
                     else
                     {
                         root.eulerAngles = new Vector3(root.eulerAngles.x, root.eulerAngles.y, 90);
                     }
                 }
                 cleanRoot();
                 string status = cubeStatus.GetStatus();
                 //print(status);
                 if (cubeStatus.isFinished(status))
                 {
                     if (!controlTimer.readyToggle.isOn)
                     {
                         controlTimer.readyToggle.isOn = true;
                         controlTimer.stopTimer();
                         audioSource.clip   = audioFinished;
                         audioSource.volume = 1.0f;
                         audioSource.Play();
                     }
                 }
             }
         }
     }
 }