public void StartDialog(DialogXMLObject.Dialog dialog, string lineId, Sprite dialogSprite, DialogColorAndFont dialogColorAndFont, bool playerCanMove, bool canInteract) { // Set the player movement allowed or disabled SetPlayerDialogChanged(true, playerCanMove); // Move the dialog box in the UI StartCoroutine(OpenDialog()); _sentencesQueue.Clear(); // Create dialog with each sentences of a line foreach (var lines in dialog.LinesList) { if (lines.id == lineId) { foreach (var text in lines.text) { _sentencesQueue.Enqueue(text); } break; } } _letterByletter = dialogColorAndFont.GetLetterByLetter(); _canInteract = canInteract; if (_canInteract) // Press ENTER to go to next sentence { if (_letterByletter) // Display dialog letter by letter or the entire sentence directly { InputsEventManager.OnEnterPressed += DisplayNextSentenceLetterByLetter; } else { InputsEventManager.OnEnterPressed += DisplayNextSentence; } } StartCoroutine(StartTextDisplay(dialogSprite, dialogColorAndFont)); }
private void Awake() { _dialogManager = FindObjectOfType <DialogManager>(); _dialog = dialogObject.Load(); // Load XML file }