private void ImageCloseSpeech(CloseImageInput imageClose) { SpeechBubbleSettings settings1 = new SpeechBubbleSettings(); settings1.MaxWidth = 300; settings1.TimeUntilClose = 3; settings1.TimeBetweenChars = 0.03f; SpeechBubbleSettings settings2 = new SpeechBubbleSettings(); settings2.MaxWidth = 300; settings2.TimeUntilClose = 3; settings2.TimeBetweenChars = 0.03f; switch (interactableObjectData.clueType) { case PictureType.Baby: settings1.Text = "Baby pic text"; settings2.Text = "Text 2"; break; case PictureType.Book: settings1.Text = "That taco recipe sounds delicious."; settings2.Text = "It's always important to add love."; break; case PictureType.Dancing: settings1.Text = "If only you knew how to dance."; settings2.Text = "You could take that girl next door waltzing."; break; case PictureType.Honeymoon: settings1.Text = "Maybe you’re going to the beach with mom and dad today?"; settings1.MaxWidth = 400; settings2.Text = "….Where are they, anyway?"; break; case PictureType.Kid: settings1.Text = "You haven’t spoken to your grandpa in…it must be *months* now."; settings2.Text = "Is that it? Did you forget to call him for his birthday?"; break; case PictureType.Mountain: settings1.Text = "The painting says “Icy wintertime”"; settings2.Text = "It calls to mind lovely, blooming flowers, and a woman calling out in the storm."; settings2.MaxWidth = 500; break; case PictureType.Snow: settings1.Text = "You remember going skiing with your family."; settings2.Text = "Who was the lady that was with you though?"; break; default: break; } SpeechBubbleSettings[] settingsArray = { settings1, settings2 }; SpeechBubble.Instance.DisplaySpeech(settingsArray); imageClose.UnregisterOnClose(ImageCloseSpeech); }
private void SetTimeBetweenChars(SpeechBubbleSettings speechBubbleSettings) { if (speechBubbleSettings.WriteTextTime == 0) { _TimeBetweenChars = speechBubbleSettings.TimeBetweenChars; } else { _TimeBetweenChars = speechBubbleSettings.WriteTextTime / speechBubbleSettings.Text.Length; } }
private void InitialScript() { SpeechBubbleSettings text1 = new SpeechBubbleSettings(); SpeechBubbleSettings text2 = new SpeechBubbleSettings(); SpeechBubbleSettings text3 = new SpeechBubbleSettings(); SpeechBubbleSettings text4 = new SpeechBubbleSettings(); text1.Text = "Something's... not right."; text2.Text = "Today is important for some reason, but you can’t quite place it."; text3.Text = "Where’s that nice lady who remembers things for you?"; text4.Text = "She would know what’s going on."; text1.MaxWidth = 300; text2.MaxWidth = 500; text3.MaxWidth = 400; text4.MaxWidth = 300; text3.TimeUntilClose = 1; text4.TimeUntilClose = 1; SpeechBubbleSettings[] settingsArray = { text1, text2, text3, text4 }; DisplaySpeech(settingsArray); }
private void ChangeToMainGameAfterFade() { FadedToAndFromBlackManager.Instance.UnregisterForFinishedFading(ChangeToMainGameAfterFade); bool pass = _SavedPass; string puzzlename = _SavedPuzzleName; if (puzzlename == "none") { Debug.LogWarning("ChangeToMainGame called without 2nd parameter"); } FlowerGame.SetActive(false); FridgeGame.SetActive(false); DancingGame.SetActive(false); MainGame.SetActive(true); if (pass) { if (puzzlename == "dance") { if (danceSolved == false) { FindObjectOfType <AudioManager>().ToHomeMusicOnSuccess(); settings.Text = "There was a girl next door who loved to dance."; settings.MaxWidth = 300; SpeechBubbleSettings speech2 = new SpeechBubbleSettings(); SpeechBubbleSettings speech3 = new SpeechBubbleSettings(); speech2.Text = "She had three left feet, but she sure did have fun."; speech3.Text = "Maybe you’ll see her again someday…"; speech2.MaxWidth = 300; speech3.MaxWidth = 200; speech2.TimeBetweenChars = speech3.TimeBetweenChars = 0.03f; speech2.TimeUntilClose = speech3.TimeUntilClose = 2; SpeechBubbleSettings[] settingsArray = { settings, speech2, speech3 }; SpeechBubble.Instance.DisplaySpeech(settingsArray); } de.SetDistortionLevel(de.GetDistortionLevel() + 1); danceSolved = true; } else if (puzzlename == "flower") { if (flowerSolved == false) { settings.Text = "That’s it! It’s the remembering-lady’s birthday today."; settings.MaxWidth = 300; SpeechBubbleSettings speech2 = new SpeechBubbleSettings(); speech2.Text = "She liked purple flowers too, just like the dancing girl…"; speech2.MaxWidth = 300; speech2.TimeBetweenChars = 0.03f; speech2.TimeUntilClose = 2; SpeechBubbleSettings[] settingsArray = { settings, speech2 }; SpeechBubble.Instance.DisplaySpeech(settingsArray); FindObjectOfType <AudioManager>().ToHomeMusicOnSuccess(); } de.SetDistortionLevel(de.GetDistortionLevel() + 1); flowerSolved = true; } else if (puzzlename == "fridge") { if (fridgeSolved == false) { settings.Text = "The dancing girl…"; settings.MaxWidth = 200; SpeechBubbleSettings speech2 = new SpeechBubbleSettings(); SpeechBubbleSettings speech3 = new SpeechBubbleSettings(); speech2.Text = "You wrote a poem for her just like this once."; speech3.Text = "She always did love purple flowers."; speech2.MaxWidth = 300; speech3.MaxWidth = 200; speech2.TimeBetweenChars = speech3.TimeBetweenChars = 0.03f; speech2.TimeUntilClose = speech3.TimeUntilClose = 2; SpeechBubbleSettings[] settingsArray = { settings, speech2, speech3 }; SpeechBubble.Instance.DisplaySpeech(settingsArray); FindObjectOfType <AudioManager>().ToHomeMusicOnSuccess(); } de.SetDistortionLevel(de.GetDistortionLevel() + 1); fridgeSolved = true; } //if(danceSolved && flowerSolved && fridgeSolved) //TODO:insert final game ending events //TODO: insert flavor text for both success and failure. FindObjectOfType <AudioManager>().ToHomeMusicOnFailure(); } else { string[] texts = new string[] { "The memory slips through your fingers and into air.", "No, that’s not it. The memory fails you.", "The moment passes. The memory fades." }; settings.Text = texts[UnityEngine.Random.Range(1, 3)]; SpeechBubbleSettings[] settingsArray = { settings }; SpeechBubble.Instance.DisplaySpeech(settingsArray); FindObjectOfType <AudioManager>().ToHomeMusicOnFailure(); } FadedToAndFromBlackManager.Instance.FadeFromBlack(); if (danceSolved == true && fridgeSolved == true && flowerSolved == true) { EndGame.SetActive(true); DiningRoomLight.SetActive(false); Forget.SetActive(false); Remember.SetActive(true); PurpleRose.SetActive(true); } }
// Update is called once per frame void Update() { int frames = _DefaultFramesToOpen; if (FramesToOpen != 0) { frames = FramesToOpen; } if (_TimeOpened >= _TimeToClose) { UITextComponent.text = ""; if (_Bubbles.Length > 1) { ResetValues(); SpeechBubbleSettings[] newBubbles = new SpeechBubbleSettings[_Bubbles.Length - 1]; for (int index = 1; index < _Bubbles.Length; index++) { newBubbles[index - 1] = _Bubbles[index]; } DisplaySpeech(newBubbles); } if (BlackBox.minHeight > 0 || BlackBox.minWidth > 0) { BlackBox.minHeight -= _TrueHeight / frames; BlackBox.minWidth -= _TrueWidth / frames; } else { BlackBox.minHeight = 0; BlackBox.minWidth = 0; ResetValues(); } return; } if (BlackBox.minHeight < _TrueHeight || BlackBox.minWidth < _TrueWidth) { BlackBox.minHeight += _TrueHeight / frames; BlackBox.minWidth += _TrueWidth / frames; return; } else { BlackBox.minHeight = _TrueHeight; BlackBox.minWidth = _TrueWidth; } if (_FullText == "") { return; } if (_MarkupText.Count > 0 && _MarkupText[_MarkupText.Count - 1].alphaIndex == _MarkupColors.Length - 1 && _MarkupText.Count == _FullText.Length) { _TimeOpened += Time.deltaTime; return; } _Timer += Time.deltaTime; _MarkupTimer += Time.deltaTime; if (_MarkupTimer >= _TimeBetweenChars / _MarkupColors.Length) { // Add new character if (_Timer >= _TimeBetweenChars && _MarkupText.Count != _FullText.Length) { MarkupLetter nextLetter = new MarkupLetter(); nextLetter.letter = _FullText[_MarkupText.Count]; nextLetter.alphaIndex = 0; _MarkupText.Add(nextLetter); _Timer = 0; } UITextComponent.text = UpdateMarkupTextAlphas(); } if (_MarkupTimer >= _TimeBetweenChars) { _MarkupTimer = 0; } }