void Start()
    {
        musicHandler = GameHandler.musicHandler;

        loopLength = musicHandler.GetCurrentSequenceLength() * loopLengthMultiplier;

        SetState(State.FadeFromWhite);
    }
    // Use this for initialization
    void Start()
    {
        musicHandler = GameHandler.musicHandler;

        float loopLength      = musicHandler.GetCurrentSequenceLength();
        float currentLoopTime = musicHandler.GetCurrentSequenceTime();

        float minCutsceneTime = minWingsFadeIn + wingsShowTime + fadeToWhiteTime;

        float nrOfLoops         = Mathf.Ceil((currentLoopTime + minCutsceneTime) / loopLength);
        float totalCutsceneTime = nrOfLoops * loopLength - currentLoopTime;

        float timeDiff = totalCutsceneTime - minCutsceneTime;

        wingFadeTime    = minWingsFadeIn + (timeDiff * 0.5f);
        fadeToWhiteTime = minFadeToWhiteTime + (timeDiff * 0.5f);

        SetState(State.FadingInWings);
    }
    void UpdateFadeToWhite()
    {
        float alpha = Mathf.Clamp01(currentTimer / fadeToWhiteTime);

        white.GetComponent <Image>().color = new Vector4(1, 1, 1, alpha);

        if (!musicTriggered)
        {
            float fadeTimeLeft = fadeToWhiteTime - currentTimer;
            if (fadeTimeLeft < musicHandler.GetCurrentSequenceLength() - musicHandler.GetLoopFadeTime())
            {
                musicTriggered = true;
                musicHandler.TriggerLoopSequence(musicTrigger);
            }
        }

        if (alpha == 1)
        {
            GameHandler.sceneLoader.LoadScene(nextScene);
        }
    }
    void UpdateFadeOutOrion()
    {
        float alpha = Mathf.Clamp01(currentTimer / orionFadeTime);

        overlay.GetComponent <Image>().color = new Vector4(1, 1, 1, alpha);

        if (alpha == 1.0f)
        {
            float loopLength      = musicHandler.GetCurrentSequenceLength();
            float currentLoopTime = musicHandler.GetCurrentSequenceTime();

            float minimumLoops = currentLoopTime < musicHandler.GetLoopFadeTime() ? 1 : 2;

            float nrOfLoops = Mathf.Max(minimumLoops, Mathf.Ceil((currentLoopTime + minCreditsTime) / loopLength));
            creditsTime = nrOfLoops * loopLength - currentLoopTime;

            credits.StartCredits(creditsTime);

            SetState(State.Credits);
            musicHandler.TriggerLoopSequence(musicTrigger);
        }
    }