Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        // If we're waiting to fade in then time it
        if (waitForFadeIn)
        {
            timer += Time.deltaTime;
            // If the timer limit is hit then stop waiting and start fading
            if (timer > fadeDelay || nextJukebox == intersatellary)
            {
                timer         = 0f;
                waitForFadeIn = false;
                startFadeIn   = true;
            }
        }

        // Start the fade in
        if (startFadeIn)
        {
            if (introMusic.intro)
            {
                introMusic.FadeOut();
            }
            nextJukebox.FadeIn(fadeSpeed);
            startFadeIn = false;
        }

        if (!musicOn)
        {
            satellary.MusicOff();
            intersatellary.MusicOff();
            station.MusicOff();
            introMusic.MusicOff();
        }
        else
        {
            satellary.MusicOn();
            intersatellary.MusicOn();
            station.MusicOn();
            introMusic.MusicOn();
        }
    }