예제 #1
0
    void Update()
    {
        if (!wasTutorialHidden)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                wasTutorialHidden = true;
                blackScreen.GetComponent <UIImageFader>().FadeOut(10f);
                tutorialTitle.GetComponent <UITextFader>().FadeOut(10f);
                tutorialText.GetComponent <UITextFader>().FadeOut(10f);

                // Kick off the gameplay
                dialogSystem.ChangeActive(true, "Intro");
            }
        }

        if (deathScreenTimer.IsDone())
        {
            player.GetComponent <Player>().Respawn();
            deathText.GetComponent <UITextFader>().FadeOut(2f);
            blackScreen.GetComponent <UIImageFader>().FadeOut(2f);
            deathScreenTimer.Reset();
        }

        if (dialogSystem.HasFinished("Intro"))
        {
            postIntroText.GetComponent <UITextFader>().FadeIn(2f);
            postIntroTimer.Start(7f);
        }
        if (postIntroTimer.IsDone())
        {
            postIntroText.GetComponent <UITextFader>().FadeOut(2f);
            postIntroTimer.Reset();
        }

        if (dialogSystem.HasFinished("BlueFire"))
        {
            // Activate new ghosts
            foreach (GameObject g in rageGhosts)
            {
                g.SetActive(true);
            }
            Debug.Log("Ghosts to kill " + ghostCount);
        }

        // Ending sequence
        noise.volume = Mathf.Lerp(0.05f, 0f, ending ? 1f : beforeEndingTimer.GetProgress());
        if (beforeEndingTimer.IsDone())
        {
            // At this point the screen is black
            GameObject.Find("Sun").GetComponent <Light>().intensity = 1f;
            GameObject.Find("Campfire/Point Light").SetActive(false);
            GameObject.Find("Campfire/Particle System").SetActive(false);
            player.GetComponent <Player>().Respawn();
            player.GetComponent <Player>().MovementEnabled = false;

            dialogSystem.ChangeActive(true, "Ending");

            beforeEndingTimer.Reset();
            blackScreen.GetComponent <UIImageFader>().FadeOut(3f);

            ending = true;
        }

        if (dialogSystem.HasFinished("Ending"))
        {
            player.GetComponent <Player>().MovementEnabled = false;
            blackScreen.GetComponent <UIImageFader>().FadeIn(3f);
            thankYouText.GetComponent <UITextFader>().FadeIn(3f);
        }
    }