//------------------------------------------------------------------------- void Update() { // update time time_ += Time.deltaTime; // update the fader buttonFader_.Update(Time.deltaTime); backgFader_.Update(Time.deltaTime); musicFader_.Update(Time.deltaTime); // fade buttons in after ... if (time_ > 8.1f && !haveButtonsFadedIn_) { haveButtonsFadedIn_ = true; buttonFader_.FadeIn(); } // if buttons are fully blended in set them clickable // otherwise set them non clickable if (StartButton.GetAlpha() == 1.0f) { StartButton.SetIsClickable(true); } // if buttons are fully blended in set them clickable // otherwise set them non clickable if (ExitButton.GetAlpha() == 1.0f) { ExitButton.SetIsClickable(true); } // if the start button was pressed (shallExitMM) and the background and // buttons are blended out load the intro if (BackgroundTex.GetAlpha() == 0.0f && buttonFader_.GetAlpha() == 0.0f && shallExitMM_ ) { // Load intro Application.LoadLevel(2); } // update alpha values of the gui elements BackgroundTex.SetAlpha(backgFader_.GetAlpha()); StartButton.SetAlpha(buttonFader_.GetAlpha()); ExitButton.SetAlpha(buttonFader_.GetAlpha()); // update volume BackgroundMusic.SetVolume(musicFader_.GetAlpha()); if (StartButton.IsPressed()) { shallExitMM_ = true; StartButton.SetIsClickable(false); ExitButton.SetIsClickable(false); backgFader_.FadeOut(); buttonFader_.FadeOut(); musicFader_.FadeOut(); } if (ExitButton.IsPressed()) { Application.Quit(); } }