private IEnumerator WriteDialogue(MapDialogue dialogue) { busy = true; if (dialogue.scriptDialogue && !screenDim.activeSelf) { screenDim.SetActive(true); } if (dialogue.textBox1) { namePlate1.text = ""; portrait1.sprite = null; textBox1.text = ""; namePlate1.text = dialogue.unit.unitName; portrait1.gameObject.SetActive(true); portrait1.sprite = dialogue.unit.portrait; portrait1.GetComponent <RectTransform>().localScale = new Vector3(-1, 1, 1); } else { namePlate2.text = ""; portrait2.sprite = null; textBox2.text = ""; namePlate2.text = dialogue.unit.unitName; portrait2.gameObject.SetActive(true); portrait2.sprite = dialogue.unit.portrait; } for (int i = 0; i < dialogue.dialogue.Length; i++) { if (dialogue.textBox1) { textBox1.text += dialogue.dialogue[i]; SoundManager.instance.PlayFX(7); yield return(new WaitForSeconds(0.01f)); } else { textBox2.text += dialogue.dialogue[i]; SoundManager.instance.PlayFX(7); yield return(new WaitForSeconds(0.01f)); } } if (dialogue.textBox1) { dialogueCursorTop.SetActive(true); } else { dialogueCursorBot.SetActive(true); } dialogue.finished = true; lastDialogue = null; lastDialogue = dialogue; busy = false; yield return(null); }
public void WriteSingle(MapDialogue dialogue) { StartCoroutine(WriteSingleDialogue(dialogue)); }