Dialog manager - show full sentence before going to next sentence
Hi all!
Need some advice on this dialog manager.
I've used this great tutorial from brackeys to make the manager https://www.youtube.com/watch?v=_nRzoTzeyxU
The issue is, that at the moment if the player presses space during the typing coroutine it skips the dialog and just goes to the next sentence. I would love to be able to have it, so that if the player pressed space during the coroutine that it just revealed the full sentence, then they would need to press space a second time to skip to the next sentence.
But if they had not tried to skip the sentence during the typing effect, pressing space would just take them to the next sentence.
Sorry if this has been answered elsewhere, or if I'm just missing something really obvious, but any help would be hugely appreciated.
Thanks in advance :)
void Start() { sentences = new Queue(); canMove = false;
}
public void StartDialogue(Dialogue dialogue)
{
sentences.Clear();
foreach (string sentence in dialogue.sentences)
{
sentences.Enqueue(sentence);
}
}
public void DisplayNextSentance()
{
if (sentences.Count == 0)
{
EndDialogue();
return;
}
string sentence = sentences.Dequeue();
StopAllCoroutines();
StartCoroutine(TypeSentence(sentence));
}
IEnumerator TypeSentence(string sentence)
{
dialogtext.text = "";
foreach (char letter in sentence.ToCharArray())
{
dialogtext.text += letter;
yield return new WaitForSeconds(0.025f);
}
}
public void EndDialogue()
{
canMove = true;
Invoke("activechar", 1f);
Destroy(destoryObject);
}
Your answer
Follow this Question
Related Questions
Implementing Json for dialogue system? 0 Answers
Add points every five seconds 1 Answer
Coroutine or While loop that you can reset/add time too? 0 Answers