Ejemplo n.º 1
0
    void ChangeDialogueOnClick()
    {
        if (CurrentSentence == 0)
        {
            DialogueControllerRef.OpenDialogue();
        }
        else if (CurrentSentence == DialogueDataRef.Dialogue.Count || (PrintGibberish && CurrentSentence >= 3))
        {
            if (!PrintGibberish)
            {
                screenFadeRef.loadNextLevel();
            }
            DialogueControllerRef.CloseDialogue();
            CurrentSentence = 0;
            return;
        }

        var characterName = CharacterNamesDataRef.CharacterName[CurrentSentence];

        if (CharacterNamesDataRef.CharacterName[CurrentSentence] == "Player_Initial")
        {
            characterName = playerName[0] + "...";
        }
        else if (CharacterNamesDataRef.CharacterName[CurrentSentence] == "Player_Name")
        {
            characterName = playerName;
        }

        var    DialogueLine = DialogueDataRef.Dialogue[CurrentSentence];
        string replacement;
        string trueSentence = DialogueDataRef.Dialogue[CurrentSentence];

        if (DialogueLine.Contains("Player_Name"))
        {
            replacement  = DialogueLine.Replace("Player_Name", playerName);
            trueSentence = replacement;
        }


        string sentence = PrintGibberish ? gibberish(trueSentence.Length) : trueSentence;

        string name = PrintGibberish ? gibberish(characterName.Length) : characterName;

        DialogueControllerRef.DisplayDialogue(name, sentence);

        CurrentSentence += 1;
    }
Ejemplo n.º 2
0
    void startTutorial()
    {
        string errorMessage = "Name must be between 2 and 8 characters";

        if (NameInputField.text.Length > 1 && NameInputField.text.Length < 9 && NameInputField.text != errorMessage)
        {
            openingSceneCanvas.gameObject.SetActive(false);

            scenePassThroughDataRef.playerName = NameInputField.text;
            screenFadeRef.loadNextLevel();
            //SceneManager.LoadScene("TutorialScene");
        }
        else
        {
            NameInputField.text = errorMessage;
        }
    }