Пример #1
0
    // If the current line that we are interested in is less lines that the number of lines in the conversation,
    // display it and increase the line index. Otherwise end the conversation.
    public void AdvanceNarrative()
    {
        // Check if this narrative is a Monologue, OR if both the speaker UI's have finished animating (to prevent UI elements from being enabled/disabled
        // before they are supposed to be)
        if (Time.timeScale == 1)
        {
            if (N.isMonologue && !speakerUILeft.isAnimating || !N.isMonologue && !speakerUILeft.isAnimating && !speakerUIRight.isAnimating)
            {
                // If there are still lines left in the dialogue OR if there are any tutorials remaining in the narrative event that have not yet been displayed
                // (typically located after the last line of dialogue)
                if (activeLineIndex < N.lines.Length || tutorialsRemaining)
                {
                    // If this narrative has tutorials, and there are tutorials remaining to be played, the tutorial line index matches the current line index,
                    // AND we are not currently displaying a tutorial
                    if (N.hasTutorial && tutorialsRemaining && N.tutorialLines[activeTutorialLineIndex] == activeLineIndex && !hasDisplayedTutorial)
                    {
                        // Hide speaker UIs
                        if (N.isMonologue)
                        {
                            speakerUILeft.Hide();
                        }
                        else
                        {
                            speakerUIRight.Hide();
                            speakerUILeft.Hide();
                        }

                        // Display tutorial that matches the index number of the activeTutorialLineIndex
                        tutorialController.DisplayTutorial(N.tutorials[activeTutorialLineIndex]);

                        // Increase the line index to select the next index line number to display the following tutorial next time (if applicable)
                        activeTutorialLineIndex++;
                        // Increase the number of tutorials we have played so we can track how many are left
                        tutorialsPlayed++;

                        // Check if we have played all the tutorials the array
                        if (tutorialsPlayed == N.tutorialLines.Length)
                        {
                            tutorialsRemaining = false;
                        }

                        hasDisplayedTutorial = true;
                    }
                    else
                    {
                        DisplayNextLine();
                        activeLineIndex += 1;
                    }
                }
                else
                {
                    EndResetNarrativeController();
                }
            }
        }
    }