private void Awake() { messageT = transform.Find("message").Find("messageT").GetComponent <Text>(); talking = transform.Find("Voice").GetComponent <AudioSource>(); transform.Find("message").GetComponent <Button_UI>().ClickFunc = () => { if (tws != null && tws.IsActive()) { tws.WriteAndDestroy(); } else { if (i <= 12) { message = messageArray[i]; StartTalkingSound(); tws = TextWriting.AddWritingStatic(messageT, message, .05f, true, true, StopTalkingSound); i += 1; } else { float seconds = .4f; StartCoroutine(_wait(seconds)); //test(); } } }; }
IEnumerator _wait(float time) { message = messageArray[i]; StartTalkingSound(); tws = TextWriting.AddWritingStatic(messageT, message, .05f, true, true, StopTalkingSound); yield return(new WaitForSeconds(time)); SceneManager.LoadScene("MainMenu"); }
private void Start() { StartTalkingSound(); tws = TextWriting.AddWritingStatic(messageT, "Hello Folks! \n" + "Just click somewhere inside the bubble to continue …", .05f, true, true, StopTalkingSound); }