Example #1
0
 private IEnumerator AnimationRotate(int amount, bool checkForUnscrambled)
 {
     isRotating = true;
     BehaviourBall[] balls = transform.GetComponentsInChildren <BehaviourBall>();
     foreach (BehaviourBall ball in balls)
     {
         if (ball.gameObject.activeInHierarchy)
         {
             ball.EventChannelRotate(-1);
         }
     }
     for (int i = 0; i < 90; i += rotateSpeed)
     {
         int speed = rotateSpeed;
         while (i + speed > 90)
         {
             speed--;
         }
         speed *= amount;
         transform.rotation *= Quaternion.Euler(0, 0, speed);
         yield return(new WaitForSeconds(0.01f));
     }
     if (gameManager.loadedLevel.index >= 0)
     {
         if (checkForUnscrambled)
         {
             gameManager.EventCheckForUnscrambled();
         }
     }
     else
     {
         editorManager.EventPlayCheck();
     }
     isRotating = false;
 }