IEnumerator EndGameCoroutine(LevelEnd levelEnd) { DialogueSystem.CloseDialogue(); LoadingBar.OnDisableInput(); AcceptingInputStatus.DisableAcceptingInput(); BackgroundSoundPlayer.Stop(); if (levelEnd == LevelEnd.IMPATIENT) { audioSource.PlayOneShot(fart); LoadingBar.FillRestOfLoadingBar(fart.length); yield return(new WaitForSeconds(fart.length)); } if (levelEnd != LevelEnd.HEART && levelEnd != LevelEnd.SHAKE) { audioSource.PlayOneShot(toiletFlushing); yield return(new WaitForSeconds(toiletFlushing.length)); } MainCamera.ZoomOut(); if (levelEnd == LevelEnd.SHAKE) { Door.OpenDoorCensored(); dwarf.GetComponentInChildren <Renderer>().material = dwarfToiletPapered; } else { Door.OpenDoor(); } audioSource.PlayOneShot(doorSqueak); yield return(new WaitForSeconds(doorSqueak.length)); dwarf.SetActive(true); dwarf.GetComponentInChildren <Animator>().speed = 1 / footSteps.length; audioSource.PlayOneShot(footSteps); yield return(new WaitForSeconds(footSteps.length)); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); }
public static void Trigger(LevelEnd topic) { if (instance.isDialogueShown) { return; } if (topic != instance.currentLevelEnd) { instance.currentLinesIndex = 0; } instance.currentLevelEnd = topic; instance.isDialogueShown = true; if (instance.currentLinesIndex >= instance.currentDialogueLines.Length) { Debug.Log("No more dialogue lines."); return; } DialogueLine currentLine = instance.currentDialogueLines[instance.currentLinesIndex]; if (currentLine.showNextLineAfterThis) { LoadingBar.DestroySelf(); BackgroundSoundPlayer.Stop(); } instance.text.text = currentLine.text; instance.timeLastLineShowed = Time.time; instance.wrapper.SetActive(true); instance.closeButton.gameObject.SetActive(false); instance.StartCoroutine(instance.ShowButton()); }