Esempio n. 1
0
    private void Update()
    {
        if (!paused)
        {
            et += Time.deltaTime;

            if (Time.timeSinceLevelLoad >= 15 && !playOnce)
            {
                playOnce = true;
                player.PlayCountDown(0);
            }

            if (et >= 0.0f && et < duration)
            {
                if (!playOnce2)
                {
                    playOnce2 = true;
                    player.PlayBGM(1, false);
                }

                if (!playOnce3 && et >= 50.0f)
                {
                    playOnce3 = true;
                    player.PlayCountDown(1);
                }

                mainMapScaling.et = et;
                endMapScaling.et  = et;
                barrierScript.et  = et;

                float value = et / duration;

                Color bg = Color.Lerp(startColor, endColor, value);
                mainCam.backgroundColor = bg;
                cineCam.backgroundColor = bg;

                value *= value;
                barrier.material.SetFloat("_et", et);
                barrier.material.SetFloat("_PulseSpeed", startPulseSpeed + (endPulseSpeed - startPulseSpeed) * value);
                barrier.material.SetFloat("_LineSpeed", startLineSpeed + (endLineSpeed - startLineSpeed) * value);

                // Audio pitching
                currentLerpTime += Time.deltaTime * 0.02f;
                if (currentLerpTime > lerpTime)
                {
                    currentLerpTime = lerpTime;
                }
                float t = currentLerpTime / lerpTime;
                t = 1f - Mathf.Cos(t * Mathf.PI * 0.5f);
                float final = Mathf.Lerp(1.0f, 1.25f, t);

                player.BGNAudioPitching(final, 1.0f, 1.25f);
            }

            mainCameraFollow.et        = et;
            cinemachineCameraFollow.et = et;
            scoreAreaScaling.et        = et;
            uiController.et            = et;
        }
    }