IEnumerator FadeInOutAndCameraPlayEnd(float delay) { yield return(new WaitForSeconds(delay)); MFGuiFader.FadeIn(0.3f); yield return(new WaitForSeconds(0.5f)); MFGuiFader.FadeOut(); }
IEnumerator FadeInOutAndCameraPlay(string animName) { MFGuiFader.FadeIn(0.1f); yield return(new WaitForSeconds(0.2f)); ParentAnimation[animName].blendMode = AnimationBlendMode.Blend; ParentAnimation.CrossFade(animName, 0.5f); DisabledTime = Time.timeSinceLevelLoad + ParentAnimation[animName].length; StartCoroutine(FadeInOutAndCameraPlayEnd(ParentAnimation[animName].length - 0.5f)); yield return(new WaitForSeconds(0.1f)); MFGuiFader.FadeOut(); }
IEnumerator LoadScene(string scene, bool mission) { IsLoading = true; string sceneLower = scene.ToLower(); if (sceneLower.StartsWith("mp_")) { scene = sceneLower; } // save user settings SaveSettings(); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); // waiting for 2 frames is necessary here!!! // display loading screen { // fade to black MFGuiFader.FadeIn(MFGuiFader.NORMAL); while (MFGuiFader.Fading == true) { yield return(new WaitForEndOfFrame()); } // do some cleaning and display loading screen ClearInstances(); if (AppType == E_AppType.DedicatedServer) { ApplicationDZ.LoadLevel("Empty"); } else { ApplicationDZ.LoadLevel(LoadingScreen); } // prepare fade-out MFGuiFader.FadeOut(MFGuiFader.NORMAL); MFGuiFader.Paused = true; // wait two frame // this causes much nicer initial delta time for fading yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); // finish fade-out MFGuiFader.Paused = false; while (MFGuiFader.Fading == true) { yield return(new WaitForEndOfFrame()); } } // apply graphic settings if (DeviceInfo.PerformanceGrade != (DeviceInfo.Performance)GuiOptions.graphicDetail) { DeviceInfo.Initialize((DeviceInfo.Performance)GuiOptions.graphicDetail); } // load scene { // do another cleaning and load scene ClearInstances(); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); // waiting for 2 frames is necessary here!!! yield return(Resources.UnloadUnusedAssets()); yield return(new WaitForEndOfFrame()); ApplicationDZ.LoadLevel(scene); // prepare fade-out MFGuiFader.FadeOut(MFGuiFader.SLOW); MFGuiFader.Paused = true; // waint two frames so game has time to initialize yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); //yield return Resources.UnloadUnusedAssets(); } if (mission) { if (Client.Instance) { Client.Instance.OnMissionLoaded(scene); } #if !DEADZONE_CLIENT if (Server.Instance) { Server.Instance.OnMissionLoaded(scene); } #endif } System.GC.Collect(); // clear input buffers InputManager.FlushInput(); // loading finished IsLoading = false; DownloadingLevel = null; // wait one frame // this causes much nicer initial delta time for fading yield return(new WaitForEndOfFrame()); // finish fade-out MFGuiFader.Paused = false; while (MFGuiFader.Fading == true) { yield return(new WaitForEndOfFrame()); } }