private IEnumerator DoDisplay(BeatData data) { _output.Clear(); while (_output.IsBusy) { yield return(null); } _output.Display(data.DisplayText); while (_output.IsBusy) { yield return(null); } for (int count = 0; count < data.Decision.Count; ++count) { ChoiceData choice = data.Decision[count]; _output.Display(string.Format("{0}: {1}", (count + 1), choice.DisplayText)); while (_output.IsBusy) { yield return(null); } } if (data.Decision.Count > 0) { _output.ShowWaitingForInput(); } }
private IEnumerator DoDisplay(BeatData data) { _output.Clear(); while (_output.IsBusy) { yield return(null); } _output.Display(data.DisplayText); while (_output.IsBusy) { yield return(null); } }
public void ShowNpcSpeech(string text, bool showAnimation = true) { npcSpeechAnim.gameObject.SetActive(true); npcSpeechAnim.SetTrigger("Appear"); npcSpeechText.Display(text); }
public void UpdateDisplayText() { textDisplay.Display(playerModifier); }
private void UpdateActiveDialogue() { DialogueData dialogue; m_dialogueAsset.m_dialogueData.TryGetValue(m_currentDialogueIndex, out dialogue); CharacterComponent characterComp; m_dialogueAsset.m_characterData.TryGetValue(dialogue.characterName, out characterComp); if (nextDialogue) { if (!dialogue.m_isStartNode && !dialogue.m_isBranching && !dialogue.m_isEventNode) { m_textDisplay.DisplayDialogueHeader(dialogue.characterName, characterComp.characterIcon); // do all the actions for the current dialogue m_textDisplay.StopDisplayingOptions(); m_textDisplay.DisplayActiveOptionBubble(false, 0); m_textDisplay.DisplayActiveBubble(true); m_textDisplay.Display(dialogue.dialogueText); //character comp related actions characterComp.OnCharacterTalk(dialogue.GetDialogueTextWithoutTags()); SetAllCharacterEmotions(dialogue); nextDialogue = false; } else { if (dialogue.isConditionalBranching) { m_currentDialogueIndex = CheckDialogueConditions(dialogue); nextDialogue = true; } else if (dialogue.m_nextDialogueData.Count == 1) { m_currentDialogueIndex = dialogue.m_nextDialogueData[0]; nextDialogue = true; } else if (dialogue.m_nextDialogueData.Count > 1) { // display all branching options DisplayDialogueOptions(dialogue.m_nextDialogueData); nextDialogue = false; } else if (dialogue.m_nextDialogueData.Count == 0) { isActive = false; currentActiveDialogue = null; m_textDisplay.DisplayActiveBubble(false); OnDialogueComplete(); } } UpdateInventory(dialogue); UpdateQuests(dialogue); // triggering dialogue game events for (int i = 0; i < dialogue.eventObjects.Count; ++i) { dialogue.eventObjects[i].SendMessage(dialogue.eventFunctions[i]); } } bool isNextDialogueButtonPressed = Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Mouse0) || Input.GetKeyDown(KeyCode.E); if (isNextDialogueButtonPressed && !m_textDisplay.iSDone()) { m_textDisplay.StopTypeWriterEffect(); m_textDisplay.ClearDisplay(); m_textDisplay.DisplayDialogueHeader(dialogue.characterName, characterComp.characterIcon); m_textDisplay.AddToDisplayImmediate(dialogue.dialogueText); return; } if (isNextDialogueButtonPressed && m_textDisplay.iSDone()) { m_textDisplay.ClearDisplay(); // next dialogue is not branching if (dialogue.m_nextDialogueData.Count == 1) { m_currentDialogueIndex = dialogue.m_nextDialogueData[0]; hasPlayerOptions = false; nextDialogue = true; } // next dialogue is branching else if (dialogue.m_nextDialogueData.Count > 1) { if (!dialogue.isConditionalBranching) { // display all branching options DisplayDialogueOptions(dialogue.m_nextDialogueData); } else { m_currentDialogueIndex = CheckDialogueConditions(dialogue); nextDialogue = true; } } // branching option chosen if (optionChosen == true) { m_currentDialogueIndex = dialogue.m_nextDialogueData[playerSelectedOption]; hasPlayerOptions = false; nextDialogue = true; m_textDisplay.ClearDisplay(); optionChosen = false; playerSelectedOption = 0; } // dialogue is now complete if (dialogue.m_nextDialogueData.Count == 0) { isActive = false; currentActiveDialogue = null; m_textDisplay.DisplayActiveBubble(false); OnDialogueComplete(); } } // selecting player option else if (hasPlayerOptions) { float verticalInput = Input.GetAxisRaw("Vertical"); if (verticalInput != 0 && canChangeOption) { canChangeOption = false; StartCoroutine(ChangePlayerOption(dialogue.m_nextDialogueData.Count, verticalInput)); DisplayDialogueOptions(dialogue.m_nextDialogueData); } optionChosen = true; } }