public void RunDialog(DialogData data, Action onDialogComplete) { var user = GameManager.Instance.User; LeftCharacterName.text = user.Interpolate(data.LeftCharacterName); LeftCharacterImage.sprite = data.LeftCharacterImage; RightCharacterName.text = user.Interpolate(data.RightCharacterName); RightCharacterImage.sprite = data.RightCharacterImage; StartCoroutine(DialogCoroutine(data, onDialogComplete)); DialogButton1.onClick.AddListener(AdvanceDialog); DialogButton2.onClick.AddListener(AdvanceDialog); }
protected IEnumerator DialogCoroutine(DialogData data, Action onDialogComplete) { Show(); yield return(new WaitForSeconds(.25f)); foreach (var segment in data.Segments) { ShowSegment(segment); _waiting = true; while (_waiting) { yield return(null); } } Hide(); yield return(new WaitForSeconds(.25f)); onDialogComplete(); yield return(null); }