コード例 #1
0
ファイル: LevelEnder.cs プロジェクト: StaNov/LoadingGame
    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);
    }