private IEnumerator ScrambleCube() { gc.SetGuideNum(Guides.BLANK); playPauseButton.GetComponent <Button>().interactable = nextButton.GetComponent <Button>().interactable = lastButton.GetComponent <Button>().interactable = slowerButton.GetComponent <Button>().interactable = fasterButton.GetComponent <Button>().interactable = false; Pair <string, bool>[] moves = CubeSolver.Scramble(); period = SCRAMBLE_PERIOD; for (int i = 0; i < moves.Length; i++) { Pair <string, bool> move = moves[i]; UpdateScrambleFPR((double)i / moves.Length); ct.finishedRotation = false; ct.Rotate(move); yield return(new WaitUntil(() => ct.finishedRotation)); } StartCoroutine(SolveCube()); }
private IEnumerator DoDemo(int n) { safeToStop = true; ct.SetBlocks(guides[n].Item2); ct.MakeUnscrambled(false); ct.SetRotationSpeedIndex(Random.Range(5, 8)); yield return(new WaitForSeconds(3f)); for (int i = 0; i < guides[n].Item3.Length; i++) { safeToStop = false; ct.finishedRotation = false; ct.Rotate(guides[n].Item3[i]); yield return(new WaitUntil(() => ct.finishedRotation)); safeToStop = true; yield return(new WaitForSeconds(0.25f)); } safeToStop = true; yield return(new WaitForSeconds(3f)); StartCoroutine(cr = DoDemo(n)); }