Example #1
0
        private IEnumerator EndGame_Coroutine()
        {
            var delay1 = 1f;

            yield return(new WaitForSeconds(delay1));

            PlayIdleMusic();
            Reset();

            // Everybody dance!
            FriendsZonesManager.instance.EverybodyDance();
            antura.ReactToEndGame();

            // Zoom out camera
            var fromPosition = sceneCamera.transform.localPosition;
            var toPosition   = endCameraPosition;
            var fromRotation = sceneCamera.transform.localRotation.eulerAngles;
            var toRotation   = endCameraRotation;
            var interpolant  = 0f;
            var lerpProgress = 0f;
            var lerpLength   = 2f;

            while (lerpProgress < lerpLength)
            {
                sceneCamera.transform.localPosition = Vector3.Lerp(fromPosition, toPosition, interpolant);
                sceneCamera.transform.localRotation = Quaternion.Euler(Vector3.Lerp(fromRotation, toRotation, interpolant));
                lerpProgress += Time.deltaTime;
                interpolant   = lerpProgress / lerpLength;
                interpolant   = Mathf.Sin(interpolant * Mathf.PI * 0.5f);
                yield return(new WaitForFixedUpdate());
            }

            //            endGameCanvas.gameObject.SetActive(true);
            //
            //            int numberOfStars = 0;
            //
            //            if (friendships <= 0)
            //            {
            //                numberOfStars = 0;
            //                WidgetSubtitles.I.DisplaySentence("game_result_retry");
            //            }
            //            else if ((float)friendships / numberOfRounds < 0.5f)
            //            {
            //                numberOfStars = 1;
            //                WidgetSubtitles.I.DisplaySentence("game_result_fair");
            //            }
            //            else if (friendships < numberOfRounds)
            //            {
            //                numberOfStars = 2;
            //                WidgetSubtitles.I.DisplaySentence("game_result_good");
            //            }
            //            else
            //            {
            //                numberOfStars = 3;
            //                WidgetSubtitles.I.DisplaySentence("game_result_great");
            //            }
            //            starFlowers.Show(numberOfStars);

            PlayState.OnResult();
        }