IEnumerator SpawnClownerCust() { yield return(new WaitForSeconds(2)); clownerCust.SetActive(true); TutFindPlayer findPlayerAi = clownerCust.GetComponent <TutFindPlayer>(); if (findPlayerAi) { findPlayerAi.SetReachedPlayerCallback(() => { movementController.DisableMovementOfPlayer(); Dialogue clownerDialogue = DialogueParser.Parse( "{[R]1}Rumour has it that the one behind this chaos is a clown-" + "{[R]1}Wait... What's that sound?"); dialogueLoader.LoadAndRun(clownerDialogue, customerController); dialogueLoader.SetDialogueEndCallback(() => { Debug.Log("Meet Donald McRonald in 2.5 seconds"); StartCoroutine(LoadGameScene()); }); }); } }
IEnumerator SpawnFinalCust() { yield return(new WaitForSeconds(2)); // can adjust this longer/shorter as you deem fit clownerCust.SetActive(true); TutFindPlayer findPlayerAi = clownerCust.GetComponent <TutFindPlayer>(); if (findPlayerAi) { findPlayerAi.SetReachedPlayerCallback(() => { movementController.DisableMovementOfPlayer(); Dialogue clownerDialogue = DialogueParser.Parse( "{[R]1}Hey chef, thanks for the happy meal-" + "{[R]1}Knowing the monsters are gone really puts a smile to our faces :)" + "{[R]1}Thank you for restoring peace to the town!"); dialogueLoader.LoadAndRun(clownerDialogue, customerController); dialogueLoader.SetDialogueEndCallback(() => { Debug.Log("Rolling the credits ~"); ShowCredits(); // not sure if should change this to coroutine? }); }); } }