예제 #1
0
 IEnumerator Rotate()
 {
     while (true)
     {
         currentT += Time.deltaTime / SlerpInterval;
         if (isWaiting)
         {
             if (currentT >= 0.3f)
             {
                 isWaiting = false;
                 FadingScript.Appear();
             }
         }
         else
         {
             if (!isFreezing)
             {
                 if (currentT >= 1)
                 {
                     isFreezing    = !isFreezing;
                     currentT      = 0;
                     fadeWasInited = false;
                 }
                 else
                 {
                     transform.eulerAngles = Vector3.Lerp(startRotation, endRotation, currentT);
                     transform.position    = Vector3.Lerp(startCoordinates, endCoordinates, currentT);
                 }
             }
             else
             {
                 if (!fadeWasInited && currentT >= 0.2)
                 {
                     fadeWasInited = true;
                     FadingScript.Fade();
                 }
                 if (currentT >= 0.5)
                 {
                     isFreezing    = false;
                     currentT      = 0;
                     fadeWasInited = false;
                     isWaiting     = true;
                 }
             }
         }
         yield return(null);
     }
 }