コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (loadGame == true)
        {
            if (screenFader.FadeDone())
            {
                SceneManager.LoadScene("Game");
            }
        }

        if (loadCredits == true)
        {
            if (screenFader.FadeDone())
            {
                SceneManager.LoadScene("Credits");
            }
        }
    }
コード例 #2
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Return))
        {
            MainMenu();
        }

        // if the main menu button has been pressed and the screen fader has completely faded to black
        if (fadeToMenu == true && screenFader.FadeDone() == true)
        {
            // load the main menu scene
            SceneManager.LoadScene("MainMenu");
        }
    }
コード例 #3
0
    private void OutroNarrative()
    {
        if (screenFader.FadeDone())
        {
            if (narrativeIndex < outroNarrative.Length)
            {
                if (typingDone == false)
                {
                    typingSpeed    = outroNarrative[narrativeIndex].textSpeed;
                    dialogue.color = outroNarrative[narrativeIndex].textColor;
                    dialogue.text  = TypeDialogue(outroNarrative[narrativeIndex].dialogue);
                }

                alpha = dialogue.color.a;
            }
            else
            {
                alpha -= 1f * Time.deltaTime;

                if (alpha <= 0f)
                {
                    alpha = 0f;
                }

                Color newColor = new Color(dialogue.color.r, dialogue.color.g, dialogue.color.b, alpha);

                dialogue.color = newColor;

                if (alpha <= 0f)
                {
                    outroNarrativeDone  = true;
                    outroNarrativeStart = false;
                    narrativeIndex      = 0;

                    // run credits
                }
            }

            if (Input.GetMouseButtonDown(0))
            {
                if (typingDone == true)
                {
                    narrativeIndex++;
                    typingDone  = false;
                    outDialogue = "";
                }
            }
        }
    }
コード例 #4
0
    private void StartObjective()
    {
        // if not skipping the start
        if (skipStart == false)
        {
            // disable player controls
            fpsController.enabled = false;

            // if intro narrative is done and the screen has faded in
            if (narrativeDialogue.IntroNarrativeDone() && screenFader.FadeDone())
            {
                // if the timer until the start of the first mission is done
                if (Timer(ref timer, startToFirstMissionTime, false))
                {
                    // start the objective dialogue
                    objectiveDialogue.SetActive(true);

                    // if objective dialogue is true, update it's UI
                    if (objectiveDialogue.activeInHierarchy == true)
                    {
                        handlerUI.UpdateObjectiveDialogue("OBJECTIVE UPDATED", objectives[0]);
                    }
                }

                // if the timer has reached 4 seconds
                if (Timer(ref timer, 4f, true))
                {
                    // set objective dialogue to false change objective state and enable player controls
                    objectiveDialogue.SetActive(false);
                    currentObjectiveState = ObjectiveState.ManagerOffice;
                    fpsController.enabled = true;
                }
            }

            // start the intro narrative
            narrativeDialogue.StartIntroNarrative();
        }
        else
        {
            currentObjectiveState = ObjectiveState.ManagerOffice;
            fpsController.enabled = true;
        }
    }