public void StartNewDialogueAfterTimePass(SFX[] pSFX, DialogueScriptableObject pDialogue, int pDialogueProgress = 0)
 {
     if (_passingTime != null)
     {
         StopCoroutine(_passingTime);
     }
     _passingTime = StartCoroutine(passTime(pSFX, pDialogue, pDialogueProgress));
 }
    private IEnumerator passTime(SFX[] pSFX, DialogueScriptableObject pDialogue, int pDialogueProgress = 0)
    {
        _timePassPanel.SetActive(true);

        yield return(handleSFX(pSFX, _timePassPanel.GetComponent <Button>()));

        _timePassPanel.SetActive(false);

        StartNewDialogue(pDialogue, pDialogueProgress);
    }
Ejemplo n.º 3
0
    public void PlayDialogue()
    {
        dialogue             = dialogueScriptableObjectList[indexDialogue];
        currentTitle.text    = dialogue.title;
        currentDialogue.text = dialogue.dialogue;

        for (int i = 0; i < containerAnswers.Count; i++)
        {
            containerAnswers[i].SetAnswer(dialogue.questionTypes[i]);
        }
    }
Ejemplo n.º 4
0
    public void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        indexDialogue = 0;
        dialogue      = dialogueScriptableObjectList[indexDialogue];
        PlayDialogue();
    }
Ejemplo n.º 5
0
 void Update()
 {
     if (textBeingWrited)
     {
         TypeWriteText(); // Typewriter effect
     }
     else if (nextDialBool)
     {
         if (Input.GetKey(KeyCode.Mouse0)) // KeyCode pour skip dialogue
         {
             print("On affiche le dialogue d'après (skip): " + textSO.nextDialogue.name);
             DisplayDialogue(textSO.nextDialogue.name);
             textSO       = null;
             nextDialBool = false;
         }
     }
     else
     {
         if (ReferenceText.maxVisibleCharacters != 0)
         {
             timer += Time.deltaTime;
             if (timer >= TimeBeforeVanish)
             {
                 timer = 0;
                 if (textSO == null || textSO.nextDialogue == null)
                 {
                     textSO = null;
                     ReferenceText.maxVisibleCharacters = 0;
                     return;
                 }
                 else
                 {
                     if (NextDialWithKey)
                     {
                         nextDialBool = true;
                         print("En attente du skip..");
                     }
                     else
                     {
                         print("On affiche le dialogue d'après: " + textSO.nextDialogue.name);
                         DisplayDialogue(textSO.nextDialogue.name);
                         textSO = null;
                         ReferenceText.maxVisibleCharacters = 0;
                     }
                 }
             }
         }
     }
 }
    IEnumerator DisplayTextWhileSound(DialogueScriptableObject Cdialogue, AudioClip CvoiceLine, AudioSource source)
    {
        if (dialogueText == null)
        {
            GameObject.FindGameObjectWithTag("Dialogue");
        }

        dialogueText.text = Cdialogue.VoiceLine;

        source.PlayOneShot(CvoiceLine);

        yield return(new WaitForSeconds(CvoiceLine.length));

        source.clip = null;

        dialogueText.text = string.Empty;
    }
    public void StartNewDialogue(DialogueScriptableObject pDialogue, int pDialogueProgress = 0)
    {
        //Make a clone so that the original SO never gets changed
        _currentDialogue  = Instantiate(pDialogue);
        _dialogueProgress = pDialogueProgress - 1;

        //Make sure the VNPanel is enabled, if it was disabled for some reason
        _speechPanel.transform.parent.gameObject.SetActive(true);
        _speechPanel.SetActive(true);

        if (_speak != null)
        {
            StopCoroutine(_speak); _speak = null;
        }

        reassignSpeechBoxButtonListeners();
        nextLine();
    }
Ejemplo n.º 8
0
    public void DisplayDialogue(string nomDuDialogue) // A appeller à chaque fois qu'on souhaite afficher un nv texte
    {
        textSO = dialogueNameToSO(nomDuDialogue);
        if (textSO == null)
        {
            print("DialogueSO non trouvé.");
            return;
        }

        string newText = textSO.dialogue;

        print("On affiche le dialogue: " + nomDuDialogue);
        ReferenceText.text = "";
        ReferenceText.maxVisibleCharacters = 0;
        ReferenceText.text = newText;
        timer           = 0;
        charCount       = newText.Length;
        textBeingWrited = true;
    }
Ejemplo n.º 9
0
    void AfterAnswerChoosed(DialogueScriptableObject nextDialogue, Answertype answerType)
    {
        NextDialogue(nextDialogue);

        switch (answerType)
        {
        case Answertype.GOOD:
            if (null != onGoodAnswer)
            {
                onGoodAnswer();
            }
            break;

        case Answertype.WRONG:
            if (null != onWrongAnswer)
            {
                onWrongAnswer();
            }
            break;
        }
    }
Ejemplo n.º 10
0
 public void DisplayLineAndPlayVoice(DialogueScriptableObject dialogue, AudioClip VoiceAudio, AudioSource source)
 {
     StartCoroutine(DisplayTextWhileSound(dialogue, VoiceAudio, source));
 }
Ejemplo n.º 11
0
 public void NextDialogue(DialogueScriptableObject nextDialogue)
 {
     dialogue = nextDialogue;
     Reset();
     animator.SetTrigger("change");
 }