Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (playerInControl == true)
        {
            if (Input.GetKeyDown(KeyCode.Space) /*|| Input.GetKeyDown(KeyCode.Mouse0)*/)
            {
                if (playingDialogue == false)
                {
                    dialogueManager.LoadNextLine();
                    dialogueManager.AddToHistory(dialogueManager.finalText);

                    textCommands.CheckBracket(dialogueManager.GetTextIndex(), true); //Parsing Step #1
                    StartCoroutine("ParseQueue");
                    dialogueManager.StartCoroutine("LetterByLetter");                //Parsing Step #3
                }
                else                                                                 //Same functionality as left control/right click while dialogue is playing.
                {
                    dialogueManager.DisplayAllText();
                }
            }
            if (/*Input.GetKeyDown(KeyCode.LeftControl) || */ Input.GetKeyDown(KeyCode.Mouse1))             //Skips text playback.
            {
                if (dialogueManager.finalText == "")
                {
                    dialogueManager.LoadNextLine();
                    dialogueManager.AddToHistory(dialogueManager.finalText);

                    textCommands.CheckBracket(dialogueManager.GetTextIndex(), true); //Parsing Step #1
                    StartCoroutine("ParseQueue");                                    //Parsing Step #2
                }
                dialogueManager.DisplayAllText();                                    //Parsing Step #3
            }

            if (Input.GetKeyDown(KeyCode.C))              // Open History
            {
                dialogueManager.HistoryBox();
            }
        }
    }
 void CheckNextChar()      //Checks for special characters to run commands. If none detected, displays next character in line.
 {
     if (finalText[textIndex] == '[')
     {
         textCommands.CheckBracket(textIndex, false);
     }
     else if (finalText[textIndex] == '<')            //Checking for markup tags and adding them immediately instead of character by character
     {
         while (finalText[textIndex] != '>')
         {
             currentText += finalText[textIndex];
             textIndex++;
         }
         currentText += finalText[textIndex];
     }
     else
     {
         currentText += finalText[textIndex];
     }
 }