//Countdown for the available time. Picking a choice is done by the graph when it ends. All we need to do is to stop //showing the UI IEnumerator GUICountDown() { while (timer > 0) { timer -= Time.deltaTime; yield return(null); } currentOptions = null; }
//A function with the same name as the subscribed Event is called when the event is dispatched void OnDialogueOptions(DialogueOptionsInfo optionsInfo) { enabled = true; timer = optionsInfo.availableTime; currentOptions = optionsInfo; StopCoroutine("GUICountDown"); if (timer > 0) { StartCoroutine("GUICountDown"); } }
void OnDialogueFinished() { enabled = false; currentOptions = null; StopCoroutine("GUICountDown"); }