SceneFadeInOut.FadeToBlack C# (CSharp) Method

FadeToBlack() public method

public FadeToBlack ( ) : void
return void
    void FadeToBlack()
    {
        // Lerp the colour of the texture between itself and black.
        GetComponent<GUITexture>().color = Color.Lerp(GetComponent<GUITexture>().color, Color.black, timer);
        if (GetComponent<GUITexture>().color.a >= 0.99f)
        {
            GetComponent<GUITexture>().color = Color.black;
            GetComponent<GUITexture>().enabled = true;
            // ... reload the level.
            fadeBlack = false;
        }
        raceMusic.volume = 1 - GetComponent<GUITexture>().color.a;
        menuMusic.volume = GetComponent<GUITexture>().color.a;
    }

Usage Example

Esempio n. 1
0
 // Start the action
 public override void Start()
 {
     if (this.fadeToBlack)
     {
         fade.FadeToBlack();
     }
     else
     {
         fade.FadeToClear();
     }
 }
All Usage Examples Of SceneFadeInOut::FadeToBlack