예제 #1
0
    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);
    }
예제 #2
0
    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());
    }
예제 #3
0
 void Awake()
 {
     instance    = this;
     audioSource = GetComponent <AudioSource>();
 }