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); }
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]); } }
public void Awake() { if (Instance == null) { Instance = this; } indexDialogue = 0; dialogue = dialogueScriptableObjectList[indexDialogue]; PlayDialogue(); }
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(); }
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; }
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; } }
public void DisplayLineAndPlayVoice(DialogueScriptableObject dialogue, AudioClip VoiceAudio, AudioSource source) { StartCoroutine(DisplayTextWhileSound(dialogue, VoiceAudio, source)); }
public void NextDialogue(DialogueScriptableObject nextDialogue) { dialogue = nextDialogue; Reset(); animator.SetTrigger("change"); }