Esempio n. 1
0
    void ParseLine(Lines line)
    {
        //Debug.Log ("we are at line " + lineNum + " with this content: " + parser.GetContent (lineNum));
        string text = "";
        bool   tempEndingEnabled    = false;
        bool   instantEndingEnabled = false;

        switch (line)
        {
        case Lines.NPC:
            loveExpression = parser.GetExpression(NPCNum);
            text           = parser.GetContent(NPCNum);
            break;

        case Lines.spy:
            text = parser.GetContent(spyNum);
            tempEndingEnabled = true;
            storedEnding      = "spy";
            break;

        case Lines.love:
            text         = parser.GetContent(loveNum);
            storedEnding = "love";
            break;

        case Lines.withdraw:
            text = parser.GetContent(withdrawNum);
            break;

        case Lines.chicken:
            loveExpression = parser.GetExpression(chickenNum);
            text           = parser.GetContent(chickenNum);
            break;

        default:
            Debug.Log("====ERROR: NO SUCH ENUM LINES EXISTS");
            break;
        }

        //Split text by ~ if it contains ending instructions
        if (text.Contains("~"))
        {
            tempEnding = text.Split('~')[1];
            text       = text.Split('~') [0];

            //if ending should be changed as soon as dialgoue is accessed
            if (instantEndingEnabled)
            {
                gameManager.endingCode = tempEnding;
            }
        }
        else if (tempEndingEnabled)         //if ending should only be saved for if the option is selected again
        {
            tempEnding = null;
        }


        tempDialogue = text;
    }
Esempio n. 2
0
 void ParseLine()
 {
     if (parser.GetName(lineNum) == "VideoOff")
     {
         video.enabled = false;
     }
     else if (parser.GetName(lineNum) != "Player")
     {
         playerTalking = false;
         characterName = parser.GetName(lineNum);
         dialogue      = parser.GetContent(lineNum);
         pose          = parser.GetPose(lineNum);
         position      = parser.GetPosition(lineNum);
         DisplayImages();
     }
     else
     {
         playerTalking = true;
         characterName = "";
         dialogue      = "";
         pose          = 0;
         position      = "";
         options       = parser.GetOptions(lineNum);
         CreateButtons();
     }
 }
    void ParseLine()
    {
        if (parser.GetName(lineNum) != "Player")
        {
            Debug.Log("Parsing line of " + parser.GetName(lineNum));
            playerTalking = false;
            characterName = parser.GetName(lineNum);

            Character character = GameObject.Find(characterName).GetComponent <Character>();

            dialogueBox.color = character.textColor;

            dialogue = parser.GetContent(lineNum);
            pose     = parser.GetPose(lineNum);
            position = parser.GetPosition(lineNum);

            DisplayImages();
        }
        else
        {
            Debug.Log("Parsing player line.");
            playerTalking = true;
            characterName = "";
            dialogue      = "";
            pose          = 0;
            position      = "";
            options       = parser.GetOptions(lineNum);
            CreateButtons();
        }
    }
 void ParseLine()
 {
     if (parser.GetName(lineNum) == "EndScene")
     {
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
     }
     else if (parser.GetName(lineNum) != "Player")
     {
         playerTalking = false;
         characterName = parser.GetName(lineNum);
         dialogue      = parser.GetContent(lineNum);
         pose          = parser.GetPose(lineNum);
         position      = parser.GetPosition(lineNum);
         DisplayImages();
     }
     else
     {
         playerTalking = true;
         characterName = "";
         dialogue      = "";
         pose          = 0;
         position      = "";
         options       = parser.GetOptions(lineNum);
         CreateButtons();
     }
 }
Esempio n. 5
0
 void ParseLine()
 {
     characterName = parser.GetName(lineNum);
     dialogue      = parser.GetContent(lineNum);
     pose          = parser.GetPose(lineNum);
     position      = parser.GetPosition(lineNum);
     DisplayImages();
 }
Esempio n. 6
0
 void ParseLine()
 {
     if (parser.GetName(lineNum) == "Music")
     {
         AudioManager.instance.PlayMusic(parser.GetContent(lineNum), 1);
         lineNum++;
     }
     if (parser.GetName(lineNum) == "SoundEffect")
     {
         lineending    = false;
         playerTalking = true;
         characterName = "";
         dialogue      = "";
         pose          = 0;
         position      = "";
         StartCoroutine(PlaySound(parser.GetContent(lineNum)));
         //StringIsDisplaying = false;
     }
     else if (parser.GetName(lineNum) == "LoadScenes")
     {
         playerTalking = true;
         characterName = "";
         dialogue      = "";
         pose          = 0;
         position      = "";
         StartCoroutine(FadingLoading(parser.GetContent(lineNum)));
     }
     else if (parser.GetName(lineNum) != "Player")
     {
         playerTalking = false;
         characterName = parser.GetName(lineNum);
         dialogue      = parser.GetContent(lineNum);
         pose          = parser.GetPose(lineNum);
         position      = parser.GetPosition(lineNum);
         DisplayImages();
     }
     else
     {
         playerTalking = true;
         pose          = 0;
         position      = "";
         options       = parser.GetOptions(lineNum);
         CreateButtons();
     }
 }
Esempio n. 7
0
    // Update is called once per frame
    void Update()
    {
        setBackground();

        if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Space))
        {
            position = parser.GetPosition(lineNum);
            dialogue = replaceWithPlayerName(parser.GetContent(lineNum));

            if (position == "Q")
            {
                // question
                clickedDialogue = false;
                clickedQuestion = true;
            }
            else if (position == "S")
            {
                // load next scene
                clickedDialogue = false;
                charName        = parser.GetName(lineNum);
                dialogue        = replaceWithPlayerName(parser.GetContent(lineNum));
                StartCoroutine(ChangeScene(charName, dialogue));
                return;
            }
            else if (stillRunning)
            {
                StopCoroutine(textCoroutine);
                currText     = replaceWithPlayerName(dialogue);
                stillRunning = false;

                lineNum = lineNum + 1 + lineJump;
            }
            else
            {
                plainDisplay();
            }
        }
    }
Esempio n. 8
0
 void ParseLine()
 {
     if (parser.GetName(lineNum) == "Day")
     {
         playerTalking = false;
         ClearText();
         day = parser.GetContent(lineNum);
         ShowDay();
     }
     else if (parser.GetName(lineNum) != "Player" && parser.GetName(lineNum) != "Day")
     {
         playerTalking = false;
         characterName = parser.GetName(lineNum);
         dialogue      = parser.GetContent(lineNum);
         //dialogue = dialogue.Replace ('$', '\n');
         StartCoroutine(TypeWriterEffect());
     }
     else
     {
         playerTalking = true;
         options       = parser.GetOptions(lineNum);
         CreateButtons();
     }
 }
Esempio n. 9
0
 void ParseLine()
 {
     if (parser.GetName(lineNum) != "Player")
     {
         playerTalking = false;
         characterName = parser.GetName(lineNum);
         dialogue      = parser.GetContent(lineNum);
         emote         = parser.GetEmote(lineNum);
         DisplayImages();
     }
     else
     {
         playerTalking = true;
         characterName = "";
         dialogue      = "";
         options       = parser.GetOptions(lineNum);
         CreateButtons();
     }
 }
Esempio n. 10
0
 //determines if line is player choice, NPC dialogue, or the end of the scene
 void ParseLine()
 {
     Debug.Log("Current Script Line: " + lineNum);
     if (parser.GetName(lineNum) == "end") //end scene, start scene transition
     {
         EndDialogue();
     }
     else if (parser.GetCommand(lineNum) == "exit") //exit stage left the current character
     {
         playerTalking = false;
         command       = parser.GetCommand(lineNum);
         characterName = parser.GetName(lineNum);
         DisplayImages();
     }
     else if (parser.GetName(lineNum) == "Scene")  //this line is a scene command
     {
         playerTalking = false;
         command       = parser.GetCommand(lineNum);
         string[] commandData = command.Split(':');
         Debug.Log(commandData[0]);
         SceneCommand(commandData);                //some stuff to determine which kind of command it is. commandData!
         ParseLine();                              //re-parses the line and checks it again
     }
     else if (parser.GetName(lineNum) != "Player") //character is talking without needed player input
     {
         Debug.Log(lineNum);
         Debug.Log(parser.GetName(lineNum));
         playerTalking = false;
         characterName = parser.GetName(lineNum);
         dialogue      = parser.GetContent(lineNum);
         Debug.Log(dialogue);
         pose     = parser.GetPose(lineNum);
         position = parser.GetPosition(lineNum);
         DisplayImages();
     }
     else //player input needed
     {
         playerTalking = true;
         options       = parser.GetOptions(lineNum);
         CreateButtons();
     }
 }
 void ParseLine()
 {
     if (parser.GetName(lineNum) != "Player")
     {
         ClearButtons();
         playerTalking = false;
         characterName = parser.GetName(lineNum);
         dialogue      = parser.GetContent(lineNum);
         pose          = parser.GetPose(lineNum);
         position      = parser.GetPosition(lineNum);
         //DisplayImages();
         if (parser.GetName(lineNum + 1) == "Player")
         {
             ClearButtons();
             playerTalking = true;
             lineNum++;
             options = parser.GetOptions(lineNum);
             Debug.Log(options[0]);
             CreateButtons();
         }
     }
 }
Esempio n. 12
0
    void ParseLine()
    {
        if (mParser.GetName(mCurrentLine) != "Options")
        {
            mIsPlayerTalking   = false;
            mCharacterName     = mParser.GetName(mCurrentLine);
            mCharacterDialogue = mParser.GetContent(mCurrentLine);
            mCharacterPose     = mParser.GetPose(mCurrentLine);

            GameObject character = GameObject.Find("Anxiety");
            character.GetComponent <Character>().setTrigger(mCharacterPose);
        }
        else
        {
            mIsPlayerTalking   = true;
            mCharacterName     = "";
            mCharacterDialogue = "";
            mCharacterPose     = 0;
            mPlayerOptions     = mParser.GetOptions(mCurrentLine);
            CreateButtons();
        }
    }
Esempio n. 13
0
 void ParseLine()
 {
     if (parser.GetName(lineNum) != "Player")
     {
         playerTalking = false;
         characterName = parser.GetName(lineNum);
         dialogue      = parser.GetContent(lineNum);
         pose          = parser.GetPose(lineNum);
         position      = parser.GetPosition(lineNum);
         color         = parser.GetColor(lineNum);
         backgroundNum = parser.GetBackground(lineNum);
         musicNum      = parser.GetMusic(lineNum);
         DisplayImages();
         ChangeMusic();
     }
     else
     {
         playerTalking = true;
         options       = parser.GetOptions(lineNum);
         DisplayImages();
         CreateButtons();
     }
 }
 void ParseLine()
 {
     if (parser.GetName(lineNum) != "Player")
     {
         Debug.Log("Parsing line of " + parser.GetName(lineNum));
         playerTalking = false;
         characterName = parser.GetName(lineNum);
         dialogue      = parser.GetContent(lineNum);
         pose          = parser.GetPose(lineNum);
         position      = parser.GetPosition(lineNum);
         DisplayImages();
     }
     else
     {
         Debug.Log("Parsing player line.");
         playerTalking = true;
         characterName = "";
         dialogue      = "";
         pose          = 0;
         position      = "";
         options       = parser.GetOptions(lineNum);
         CreateButtons();
     }
 }
Esempio n. 15
0
 //  文の表示
 void ParseLine()
 {
     //  プレイヤー以外
     if (m_parser.GetName(m_lineName) != "Player")
     {
         m_playerTalking = false;
         m_characterName = m_parser.GetName(m_lineName);
         m_dialogue      = m_parser.GetContent(m_lineName);
         m_pose          = m_parser.GetPose(m_lineName);
         m_position      = m_parser.GetPosition(m_lineName);
         DisplayImages();
     }
     //  プレイヤー
     else
     {
         m_playerTalking = true;
         m_characterName = "";
         m_dialogue      = "";
         m_pose          = 0;
         m_position      = "";
         m_options       = m_parser.GetOptions(m_lineName);
         CreateButtons();
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (!clickOnce)     //preloads background
        {
            if (PlayerPrefs.HasKey("lineNum"))
            {
                pose = parser.GetPose(0);
                ChangeBackground();
                characterName = parser.GetName(1);
                pose          = parser.GetPose(1);
                position      = parser.GetPosition(1);
                lineNum       = 1;
                print(parser.GetContent(lineNum));
                preLoadChar = true;
                DisplayImages();

                print(PlayerPrefs.GetInt("lineNum") + "    REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE");
                clickOnce = true;
                //lineNum++;
            }
            else
            {
                lineNum++;
                ShowDialogue();
                print("CLICKONCE " + lineNum);
                UpdateUI();
                clickOnce = true;
                thingy.SetActive(false);
                charAnimator.SetBool("startIndicator", false);
                charAnimator.SetBool("stopIndicator", true);
            }
        }
        if (!playerTalking)
        {
            ClearButtons();
        }
        else
        {
            //if(buttons.Count == 1)
            //{
            //  buttons[0].Select();
            //}
        }
        if (playerControl == true)
        {
            if (!dialogueBox.GetComponent <AnimatedText>().done&& !dialogueBox.GetComponent <AnimatedText>().cancel&& (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown("return") || Input.GetKeyDown("space")))   //skips the dialogue
            {
                dialogueBox.GetComponent <AnimatedText>().cancel = true;
                print("CANCELLING TEXT " + lineNum);
            }

            else if (((Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown("return") || Input.GetKeyDown("space")) && playerTalking == false && dialogueBox.GetComponent <AnimatedText>().done))   //if dialogue is already skipped OR already done, go to next line
            {
                if (parser.GetName(lineNum) == characterName && !charAnimator.GetBool("fadeout" + characterName) && (charAnimator.GetBool("idle" + characterName) || charAnimator.GetBool("fadein" + characterName)))
                {
                    charAnimator.SetBool("fadeout" + characterName, true);
                    charAnimator.SetBool("idle" + characterName, false);
                    charAnimator.SetBool("fadein" + characterName, false);
                }
                Sound.PlaySound();
                dialogueBox.GetComponent <AnimatedText>().cancel = false;
                lineNum++;
                ShowDialogue();
                print("ACTION " + lineNum);
                UpdateUI();
                thingy.SetActive(false);
                charAnimator.SetBool("startIndicator", false);
                charAnimator.SetBool("stopIndicator", true);
                StartCoroutine(DelayUser());
            }
        }
    }
Esempio n. 17
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonUp(0) && playerTalking == false)
        {
            if (parser.GetName(lineNum) == "SceneChange")
            {
                //Debug.Log (parser.GetContent (lineNum));
                parser.LoadDialogue("Assets/Data/" + parser.GetContent(lineNum));
                lineNum = 0;
                ShowDialogue();
                lineNum++;
                sceneImage();
            }
            else if (parser.GetName(lineNum) == "Decision")
            {
                string[] content = parser.GetContent(lineNum).Split('-');

                string variable   = content [0];
                string comparison = content [1];
                int    valueThatWeAreComparingAgainst = int.Parse(content [2]);
                string sceneIfTrue  = content [3];
                string sceneIfFalse = content [4];

                int  comparisonValue;
                bool comparisonTrue;

                if (variable == "currentMood1")
                {
                    comparisonValue = currentMood1;
                }
                else
                {
                    comparisonValue = currentMood2;
                }
                if (comparison == "lessThan")
                {
                    if (valueThatWeAreComparingAgainst < comparisonValue)
                    {
                        comparisonTrue = true;
                    }
                    else
                    {
                        comparisonTrue = false;
                    }
                }
                else
                {
                    if (valueThatWeAreComparingAgainst > comparisonValue)
                    {
                        comparisonTrue = true;
                    }
                    else
                    {
                        comparisonTrue = false;
                    }
                }
                if (comparisonTrue)
                {
                    parser.LoadDialogue("Assets/Data/" + sceneIfTrue);
                }
                else
                {
                    parser.LoadDialogue("Assets/Data/" + sceneIfFalse);
                }
                lineNum = 0;
                ShowDialogue();
                lineNum++;
                sceneImage();
            }
            else
            {
                ShowDialogue();
                lineNum++;
            }
        }
        UpdateUI();
        showDeath();
        showSuccess();
        if (parser.GetContent(lineNum) == "Wall.txt")
        {
            sceneImage2();
        }
    }
Esempio n. 18
0
    /// <summary>
    /// Parses the DialogueLines in DialogueParser
    /// </summary>
    void ParseLine()
    {
        // if the DialogueLine's name is "Line" then set the DialogueLine's pose to lineNum and parse again
        if (parser.GetName(lineNum) == "Line")
        {
            int newLine = parser.GetPose(lineNum);
            lineNum = newLine;
            ParseLine();
        }
        else
        {
            if (parser.GetName(lineNum) != "Button")
            {
                buttonTalking = false;
                namePanel.SetActive(true);
                dialoguePanel.SetActive(true);
                characterName = parser.GetName(lineNum);
                dialogue      = parser.GetContent(lineNum);
                pose          = parser.GetPose(lineNum);
                position      = parser.GetPosition(lineNum);
                evidence      = parser.GetEvidence(lineNum);

                // if the evidence on the next line is "t", then it indicates that the next line is the beginning of a testimony
                if (parser.GetEvidence(lineNum + 1) == "t")
                {
                    // record the line number
                    Testimony = lineNum + 1;
                    progress  = false;
                    hasRead   = false;
                }

                // if the evidence on the next line is "et", then it indicates the end of a testimony
                else if (parser.GetEvidence(lineNum + 1) == "et")
                {
                    // record the line number and set hasRead to true to indicate that the testimony has been read at least once
                    endTestimony = lineNum + 1;
                    hasRead      = true;
                }

                // if the current line's evidence is "et", then reset the testimony (go back to the beginning of the testimony)
                else if (evidence == "et")
                {
                    resetTestimony(1);
                }

                // if an investigation, then add the evidence to the inventory
                else if (parser.investigation)
                {
                    evidenceName = parser.GetEvidence(lineNum);
                    addToInventory(evidenceName);
                }

                DisplayImages();
            }

            // if the name is "Button" then create buttons and don't display any dialogue
            else
            {
                buttonTalking = true;
                characterName = "";
                dialogue      = "";
                pose          = 0;
                position      = "";
                evidence      = "";
                options       = parser.GetOptions(lineNum);

                namePanel.SetActive(false);
                dialoguePanel.SetActive(false);

                CreateButtons();
            }
        }
    }
Esempio n. 19
0
    void ParseLine()
    {
        if (parser.GetName(lineNum) == "Player")
        {
            playerTalking = true;
            options       = parser.GetOptions(lineNum);
            CreateButtons();
        }
        else if (parser.GetName(lineNum) == "End")
        {
            switch (parser.GetContent(lineNum))
            {
            case "end1":
                NPCEventManager.instance.FinishMeetUp();
                SetActive(false);
                break;

            case "endDoom":
                // the evil wins the cube
                GameFlowManager.Instance.LoseCube();
                GameFlowManager.Instance.UnlockFinalDoor();
                SetActive(false);
                break;

            case "endBad":
                // go to the website
                Application.OpenURL("https://casual-development-dogdays.c9users.io/dead");
                GameFlowManager.Instance.Lose();
                SetActive(false);
                break;

            default:
                SetActive(false);
                break;
            }
        }
        else if (parser.GetName(lineNum) == "Narrative")
        {
            playerTalking = false;
            ClearButtons();
            characterName = " ";
            dialogue      = parser.GetContent(lineNum);

            //dialogue = dialogue.Replace ('$', '\n');
            cur_Coroutine = StartCoroutine(TypeWriterEffect());

            trigger = parser.GetTrigger(lineNum);
            if (trigger != "")
            {
                hasTrigger = true;
            }
        }
        else
        {
            playerTalking = false;
            ClearButtons();
            characterName = parser.GetName(lineNum);
            dialogue      = parser.GetContent(lineNum);

            //dialogue = dialogue.Replace ('$', '\n');
            cur_Coroutine = StartCoroutine(TypeWriterEffect());

            trigger = parser.GetTrigger(lineNum);
            if (trigger != "")
            {
                hasTrigger = true;
            }
        }
    }