void Update() { if (!_TitleCardFadeInstance && !IsLoadingLevel && Input.GetKeyDown(KeyCode.Tab)) { if (!CreditsInstance) { CreditsInstance = Instantiate <FadeToBlackScript>(_CreditsPrefab); } else { switch (CreditsInstance.currentStatus) { case FadeToBlackScript.FadeStatus.Black: CreditsInstance.currentStatus = FadeToBlackScript.FadeStatus.FadingToTransparent; break; case FadeToBlackScript.FadeStatus.FadingToBlack: CreditsInstance.currentStatus = FadeToBlackScript.FadeStatus.FadingToTransparent; break; case FadeToBlackScript.FadeStatus.FadingToTransparent: CreditsInstance.currentStatus = FadeToBlackScript.FadeStatus.FadingToBlack; break; } } } }
void FadeIn() { FadeToBlackScript ftb = Camera.main.gameObject.GetComponent <FadeToBlackScript>(); if (ftb == null) { ftb = Camera.main.gameObject.AddComponent <FadeToBlackScript>(); } ftb.enabled = true; ftb.FadeIn = true; ftb.fadeTime = fadeIn; }
IEnumerator LoadLevel(string LevelName) { if (IsLoadingLevel) { yield break; } IsLoadingLevel = true; FadeToBlackScript FadeInstance = Instantiate <FadeToBlackScript>(_FadePrefab); yield return(new WaitUntil(() => FadeInstance.IsOpaque)); SceneManager.LoadScene(LevelName); }
IEnumerator ManageSwipes() { bool FirstThing = true; while (true) { Image NextSwipe = QueuedSwipes.Dequeue(); Sprite CurrentSprite = NextSwipe.sprite; // If the queue of remaining things to swipe is empty, add a pocahontas sprite so that she appears infinitely if (QueuedSwipes.Count == 0) { QueuedSwipes.Enqueue(SetupSwipePhoto(_PocaHottieSprite)); } if (!FirstThing) { if (NextSwipe.sprite == _PocaHottieSprite && !_ApprovalSource.isPlaying) { _ApprovalSource.PlayRandomizedDelayed(0.75f, _ApprovalSounds); } else { _ApprovalSource.PlayRandomizedDelayed(0.75f, _DisapprovalSounds); } } yield return(HandleSwipe(NextSwipe)); _SwipeSource.PlayRandomized(_SwipeSounds); if (CurrentSprite == _PocaHottieSprite && LastSwipeResult == SwipeResult.Right) { FadeToBlackScript FadeInstance = Instantiate <FadeToBlackScript>(_ScreenFadePrefab); FadeInstance.currentStatus = FadeToBlackScript.FadeStatus.FadingToBlack; DontDestroyOnLoad(FadeInstance.gameObject); yield return(new WaitUntil(() => FadeInstance.IsOpaque)); yield return(new WaitForSeconds(1.0f)); FadeInstance.currentStatus = FadeToBlackScript.FadeStatus.FadingToTransparent; SceneManager.LoadScene(_NextScene); } FirstThing = false; } }
// Update is called once per frame void Update() { counter += Time.deltaTime; if (counter > sceneTime - fadeOut) { FadeToBlackScript ftb = Camera.main.gameObject.GetComponent <FadeToBlackScript>(); if (ftb == null) { ftb = Camera.main.gameObject.AddComponent <FadeToBlackScript>(); } ftb.enabled = true; ftb.FadeIn = false; ftb.fadeTime = fadeOut; } if (counter > sceneTime) { counter = 0; i++; print(i); if (i >= SceneManager.sceneCountInBuildSettings) { i = 0; } print(i); SceneManager.LoadScene(i); // FadeIn(); } }
void Awake() { Fade = GetComponent <FadeToBlackScript>(); Typer = GetComponent <TypeText>(); }
IEnumerator Start() { yield return(new WaitForSeconds(2.0f)); _Chooser.ShowDialogueChoice( "Do you like white meat?", "I’m gonna manifest my destiny all over you", "Are you the new world baby? Because I’m Plymouth Rock-hard" ); yield return(new WaitUntil(() => _Chooser.ChosenDialogue != null)); yield return(AddTextMessage(_JohnSmithPrefab, _Chooser.ChosenDialogue)); yield return(new WaitForSeconds(3.0f)); yield return(AddTextMessage(_PocahontasPrefab, "I’m not looking for anything serious. Just a Founding Daddy.")); yield return(new WaitForSeconds(1.0f)); _Chooser.ShowDialogueChoice( "Have you heard about our Lord and Savior, Jesus Christ?", "Let me show you my John Hancock", "Baby, let’s take it slow, I’m a Virginian" ); yield return(new WaitUntil(() => _Chooser.ChosenDialogue != null)); yield return(AddTextMessage(_JohnSmithPrefab, _Chooser.ChosenDialogue)); yield return(new WaitForSeconds(3.0f)); yield return(AddTextMessage(_PocahontasPrefab, "You better treat me right. My ex left me with a Trail of Tears.")); yield return(new WaitForSeconds(1.0f)); _Chooser.ShowDialogueChoice( "Just come over baby, I’ll keep you warm. I’ve got a lot of blankets", "Have you ever seen the inside of a cabin before?", "Let’s have a pow-wow. You can puff on my peace pipe" ); yield return(new WaitUntil(() => _Chooser.ChosenDialogue != null)); yield return(AddTextMessage(_JohnSmithPrefab, _Chooser.ChosenDialogue)); yield return(new WaitForSeconds(3.0f)); yield return(AddTextMessage(_PocahontasPrefab, "My phone number is 6")); yield return(new WaitForSeconds(1.0f)); yield return(new WaitForSeconds(3.0f)); _Chooser.ShowDialogueChoice( "My friends are doing this Thanksgiving thing. It’s pretty low-key. U should cum." ); yield return(new WaitUntil(() => _Chooser.ChosenDialogue != null)); yield return(AddTextMessage(_JohnSmithPrefab, _Chooser.ChosenDialogue)); yield return(new WaitForSeconds(3.0f)); // done! fade to the end level FadeToBlackScript FadeInstance = Instantiate <FadeToBlackScript>(_FadePrefab); yield return(new WaitUntil(() => FadeInstance.IsOpaque)); SceneManager.LoadScene("FinalCard"); }