IEnumerator sea_Exit() { CursorHide(); ImageFade.Start(uiImage, 1f, 0f, 0f); return(SnoozeFadeOut(alarmWakeUpDelay)); }
IEnumerator street_Enter() { uiTextPlayer.AutoDisplay = false; StartCoroutine(SnoozeFadeOut(snooze_fadeOut)); uiImage.sprite = street_image; ImageFade.Start(uiImage, 0f, 1f, 3f); CursorSet(street_cursor, 1f); street_lastStepTime = 0f; street_lastClickTime = 0f; street_lastClickSpeed = 0f; street_speed = street_minSpeed; street_FootstepsPaused = false; street_walkTime = 0f; street_currentOutput = 0; street_lineShown = false; street_arousalCounter = -1; street_arousalLevel = 0; street_sfxStreet.time = 0f; street_sfxStreet.Play(); const float fadeInTime = 2f; for (float t = 0; t <= fadeInTime; t += Time.deltaTime) { street_sfxStreet.volume = t / fadeInTime; yield return(null); } }
IEnumerator alarm_Enter() { Camera.main.GetComponent <NoiseAndScratches>().enabled = false; alarm_buttonClicked = false; alarm_buttonGroup.alpha = 0f; alarm_buttonObject.gameObject.SetActive(false); yield return(new WaitForSeconds(1f)); SoundAlarm(); float textDelay = story.Vars["again"] ? 1.5f : 4.5f; yield return(new WaitForSeconds(textDelay)); uiImage.sprite = alarm_imgPhone; ImageFade.Start(uiImage, 0f, 1f, 4f); CursorSet(alarm_cursor, 4f); alarm_buttonAnimator.gameObject.SetActive(true); alarm_buttonObject.gameObject.SetActive(true); alarm_buttonAnimator.SetBool("alarm", true); ImageFade.Start(alarm_buttonGroup, this, 0f, 1f, 0.2f); }
void her_Update() { if (her_done) { return; } float delta = (Input.mousePosition - her_lastMousePos).magnitude; float move = Mathf.Clamp(delta / Screen.height, 0f, 1f); Color color = uiImage.color; if (move < her_minScreenMove) { if (!ImageFade.IsInProgress(uiImage) && color.a > 0f) { ImageFade.Start(uiImage, 1f, 0f, move < her_minScreenMove ? her_minFadeoutTime : her_maxFadeoutTime); } } else if (!her_lineTriggered) { ImageFade.Stop(uiImage); color.a = Mathf.Clamp(color.a + move * her_alphaFactor, 0f, 1f); uiImage.color = color; } // Show another line if (!her_lineTriggered && color.a >= her_alphaLineTriggerUp) { TwineText line = null; while (line == null) { TwineOutput output = story.Output[her_outputIndex]; if (output is TwineText) { line = (TwineText)output; } else if (output is TwineLink && output.Name == "continue") { her_done = true; StartCoroutine(her_alarm(output as TwineLink)); break; } her_outputIndex++; } if (line != null) { uiTextPlayer.DisplayOutput(line); her_lineTriggered = true; } } else if (her_lineTriggered && color.a <= her_alphaLineTriggerDown) { her_lineTriggered = false; } her_lastMousePos = Input.mousePosition; }
void sea_Enter() { sea_current = 0; uiImage.sprite = sea_image; ImageFade.Start(uiImage, 0f, 1f, 8f); StartCoroutine(SnoozeFadeOut(2f, noise: 0f, underwater: 1f)); CursorSet(sea_cursor, 8f); }
void alarm_Exit() { alarm_sfx.loop = false; ImageFade.Start(uiImage, 1f, 0f, 0f); alarm_buttonObject.gameObject.SetActive(true); alarm_buttonAnimator.SetBool("alarm", false); alarm_buttonAnimator.gameObject.SetActive(false); ImageFade.Start(alarm_buttonGroup, this, 1f, 0f, 0f); }
void CursorShow(float fadeIn = 0f) { cursor.gameObject.SetActive(true); // Fade in if necessary if (fadeIn > 0f) { CanvasGroup group = this.cursor.GetComponentInChildren <CanvasGroup>(); Image img = this.cursor.GetComponentInChildren <Image>(); if (group != null) { ImageFade.Start(group, this, 0f, 1f, fadeIn); } else if (img != null) { ImageFade.Start(img, 0f, 1f, fadeIn); } } }
void alarm_Exit() { alarm_sfx.loop = false; const float alarmStopTime = 0.1f; ImageFade.Start(uiImage, 1f, 0f, alarmStopTime); ImageFade.Start(alarm_buttonGroup, this, 1f, 0f, alarmStopTime); CursorHide(alarmStopTime); CursorHoverClear( new StoryLink[] { story.GetCurrentLinks().Where(link => link.PassageName == "getUp").First() }, new GameObject[] { alarm_buttonObject.gameObject } ); //yield return new WaitForSeconds(alarmStopTime); alarm_buttonObject.gameObject.SetActive(false); alarm_buttonAnimator.SetBool("alarm", false); alarm_buttonAnimator.gameObject.SetActive(false); }
void CursorHide(float fadeOut = 0f) { // Fade out if necessary if (fadeOut > 0f) { CanvasGroup group = this.cursor.GetComponentInChildren <CanvasGroup>(); Image img = this.cursor.GetComponentInChildren <Image>(); if (group = null) { ImageFade.Start(group, this, 1f, 0f, fadeOut, () => this.cursor.gameObject.SetActive(false)); return; } else if (img != null) { ImageFade.Start(img, 1f, 0f, fadeOut, () => this.cursor.gameObject.SetActive(false)); return; } } this.cursor.gameObject.SetActive(false); }
IEnumerator street3_Exit() { CursorHide(); StopCoroutine(street_arousalCoroutine); AudioLowPassFilter[] lowPass = new AudioLowPassFilter[] { street_sfxFootstep1.GetComponent <AudioLowPassFilter>(), street_sfxFootstep2.GetComponent <AudioLowPassFilter>(), street_sfxStreet.GetComponent <AudioLowPassFilter>() }; for (int i = 0; i < lowPass.Length; i++) { lowPass[i].enabled = false; } _bloom.intensity = _bloomBaseValue; uiImage.color = Color.white; ImageFade.Start(uiImage, 1f, 0f, 0.1f); uiTextPlayer.AutoDisplay = true; return(SnoozeFadeOut(alarmWakeUpDelay)); }
IEnumerator alarm_Enter() { alarm_buttonClicked = false; alarm_buttonGroup.alpha = 0f; alarm_buttonObject.gameObject.SetActive(false); yield return(new WaitForSeconds(1f)); SoundAlarm(); float textDelay = story["again"] ? 1.5f : 4.5f; yield return(new WaitForSeconds(textDelay)); uiImage.sprite = alarm_imgPhone; ImageFade.Start(uiImage, 0f, 1f, 4f); alarm_buttonAnimator.gameObject.SetActive(true); alarm_buttonObject.gameObject.SetActive(true); alarm_buttonAnimator.SetBool("alarm", true); ImageFade.Start(alarm_buttonGroup, this, 0f, 1f, 0.2f); }
void sea_Enter() { uiImage.sprite = sea_image; ImageFade.Start(uiImage, 0f, 1f, 8f); StartCoroutine(SnoozeFadeOut(2f, noise: 0f, underwater: 1f)); }
void sea_Exit() { ImageFade.Start(uiImage, 1f, 0f, 0f); }
void street3_Exit() { ImageFade.Start(uiImage, 1f, 0f, 0.1f); uiTextPlayer.AutoDisplay = true; }
void her_Exit() { CursorHide(0.1f); ImageFade.Start(uiImage, 1f, 0f, 0.1f); uiTextPlayer.AutoDisplay = true; }
void her_Update() { if (her_done) { return; } float delta = (Input.mousePosition - her_lastMousePos).magnitude; float move = Mathf.Clamp(delta / Screen.height, 0f, 1f); Color color = uiImage.color; if (move < her_minScreenMove) { if (!ImageFade.IsInProgress(uiImage) && color.a > 0f) { ImageFade.Start(uiImage, 1f, 0f, move < her_minScreenMove ? her_minFadeoutTime : her_maxFadeoutTime); } } else if (!her_lineTriggered) { ImageFade.Stop(uiImage); color.a = Mathf.Clamp(color.a + move * her_alphaFactor, 0f, 1f); uiImage.color = color; if (!her_sfxMatchStrike.isPlaying) { her_sfxMatchStrike.clip = her_sfxMatchStrikeSounds[Random.Range(0, her_sfxMatchStrikeSounds.Length)]; her_sfxMatchStrike.Play(); } } // Show another line if (!her_lineTriggered && color.a >= her_alphaLineTriggerUp) { StoryOutput output = null; while (her_outputIndex < story.Output.Count && !(output is LineBreak)) { output = story.Output[her_outputIndex]; if (output is StoryText) { var line = (StoryText)output; uiTextPlayer.DisplayOutput(line); } else if (output is StoryLink && output.Name == "continue") { her_done = true; StartCoroutine(her_alarm(output as StoryLink)); break; } her_outputIndex++; } // Show the closing line break, if any if (output != null) { uiTextPlayer.DisplayOutput(output); } // Play the match light sound if (!her_done) { her_sfxMatchLight.Play(); her_cursorFlame.SetTrigger("light"); } her_lineTriggered = true; } else if (her_lineTriggered && color.a <= her_alphaLineTriggerDown) { her_lineTriggered = false; } her_lastMousePos = Input.mousePosition; }
IEnumerator snooze_Enter() { // Fade out alarm const float fadeOutTime = 0.1f; for (float fade = 0; fade <= fadeOutTime; fade += Time.deltaTime) { alarm_sfx.volume = Mathf.Lerp(alarm_sfxVolume, 0f, fade / fadeOutTime); yield return(null); } alarm_sfx.Stop(); yield return(new WaitForSeconds(2f)); CursorSet(snooze_cursor, snooze_fadeIn); snooze_sfxNoise.volume = 0f; snooze_sfxUnderwater.volume = 0f; snooze_sfxNoise.Play(); snooze_sfxUnderwater.Play(); snooze_imgAnxietyEye.gameObject.SetActive(true); snooze_imgAnxietyHalo.gameObject.SetActive(true); snooze_imgDreamEye.gameObject.SetActive(true); snooze_imgDreamHalo.gameObject.SetActive(true); Color colorAnxiety = new Color(1f, 1f, 1f, 0f); Color colorDream = new Color(1f, 1f, 1f, 0f); snooze_imgAnxietyEye.color = colorAnxiety; snooze_imgAnxietyHalo.color = colorAnxiety; snooze_imgDreamEye.color = colorDream; snooze_imgDreamHalo.color = colorDream; var cameraNoise = Camera.main.GetComponent <NoiseAndScratches>(); cameraNoise.grainIntensityMin = 0f; cameraNoise.grainIntensityMax = 0f; cameraNoise.enabled = true; Animator cursorAnimator = cursor.GetComponentInChildren <Animator>(); float t = 0; while (true) { yield return(null); t += Time.deltaTime; Vector2 mousePos = Input.mousePosition; float fadeIn = Mathf.Clamp(t / snooze_fadeIn, 0f, 1f); float anxiety = snooze_yCurve.Evaluate(mousePos.y / Screen.height); float dreaming = 1f - anxiety; float boost = snooze_xCurve.Evaluate(mousePos.x / Screen.width); snooze_sfxNoise.volume = anxiety * boost * fadeIn; snooze_sfxUnderwater.volume = dreaming * boost * fadeIn; cameraNoise.grainIntensityMin = snooze_noiseIntensity * fadeIn; cameraNoise.grainIntensityMax = snooze_noiseIntensity * fadeIn; cursorAnimator.SetInteger("snooze", boost <snooze_herTrigger ? 0 : anxiety> dreaming ? 1 : -1 ); colorAnxiety.a = anxiety * boost * fadeIn; colorDream.a = dreaming * boost * fadeIn; snooze_imgAnxietyEye.color = colorAnxiety; snooze_imgAnxietyHalo.color = colorAnxiety; snooze_imgDreamEye.color = colorDream; snooze_imgDreamHalo.color = colorDream; if (story.State == StoryState.Idle && fadeIn > 0.5f && Clicked) { yield return(null); const float imgFadeOutTime = 0.3f; ImageFade.Start(snooze_imgDreamEye, 1f, 0f, imgFadeOutTime); ImageFade.Start(snooze_imgDreamHalo, 1f, 0f, imgFadeOutTime); ImageFade.Start(snooze_imgAnxietyEye, 1f, 0f, imgFadeOutTime); ImageFade.Start(snooze_imgAnxietyHalo, 1f, 0f, imgFadeOutTime); CursorHide(snooze_fadeOut); if (boost < snooze_herTrigger) { story.DoLink("her"); StartCoroutine(SnoozeFadeOut(snooze_fadeOut)); } else if (anxiety > dreaming) { if (mousePos.x < Screen.width / 2) { story.DoLink("relationship"); } else { story.DoLink("work"); } } else { if (mousePos.x < Screen.width / 2) { story.DoLink("street"); } else { story.DoLink("sea"); } } yield break; } } }
IEnumerator snooze_Enter() { // Fade out alarm const float fadeOutTime = 0.1f; for (float fade = 0; fade <= fadeOutTime; fade += Time.deltaTime) { alarm_sfx.volume = Mathf.Lerp(alarm_sfxVolume, 0f, fade / fadeOutTime); yield return(null); } alarm_sfx.Stop(); yield return(new WaitForSeconds(2f)); snooze_sfxNoise.volume = 0f; snooze_sfxUnderwater.volume = 0f; snooze_sfxNoise.Play(); snooze_sfxUnderwater.Play(); snooze_imgAnxietyEye.gameObject.SetActive(true); snooze_imgAnxietyHalo.gameObject.SetActive(true); snooze_imgDreamEye.gameObject.SetActive(true); snooze_imgDreamHalo.gameObject.SetActive(true); Color colorAnxiety = new Color(1f, 1f, 1f, 0f); Color colorDream = new Color(1f, 1f, 1f, 0f); snooze_imgAnxietyEye.color = colorAnxiety; snooze_imgAnxietyHalo.color = colorAnxiety; snooze_imgDreamEye.color = colorDream; snooze_imgDreamHalo.color = colorDream; float t = 0; while (true) { yield return(null); t += Time.deltaTime; float fadeIn = Mathf.Clamp(t / snooze_fadeIn, 0f, 1f); float anxiety = snooze_yCurve.Evaluate(Input.mousePosition.y / Screen.height); float dreaming = 1f - anxiety; float boost = snooze_xCurve.Evaluate(Input.mousePosition.x / Screen.width); snooze_sfxNoise.volume = anxiety * boost * fadeIn; snooze_sfxUnderwater.volume = dreaming * boost * fadeIn; colorAnxiety.a = anxiety * boost * fadeIn; colorDream.a = dreaming * boost * fadeIn; snooze_imgAnxietyEye.color = colorAnxiety; snooze_imgAnxietyHalo.color = colorAnxiety; snooze_imgDreamEye.color = colorDream; snooze_imgDreamHalo.color = colorDream; if (story.State == TwineStoryState.Idle && fadeIn == 1f && uiTextPlayer.WasClicked()) { yield return(null); const float imgFadeOutTime = 0.3f; ImageFade.Start(snooze_imgDreamEye, 1f, 0f, imgFadeOutTime); ImageFade.Start(snooze_imgDreamHalo, 1f, 0f, imgFadeOutTime); ImageFade.Start(snooze_imgAnxietyEye, 1f, 0f, imgFadeOutTime); ImageFade.Start(snooze_imgAnxietyHalo, 1f, 0f, imgFadeOutTime); const float herTrigger = 0.3f; if (boost < herTrigger) { story.Advance("her"); StartCoroutine(SnoozeFadeOut(snooze_fadeOut)); } else if (anxiety > dreaming) { story.Advance("anxiety"); } else { story.Advance("dream"); } yield break; } } }