/// Show a list of options, and wait for the player to make a /// selection. private IEnumerator DoRunOptions(Yarn.OptionSet optionsCollection, ILineLocalisationProvider localisationProvider, System.Action <int> selectOption) { ds.ClearOptions(); end = false; waitingForOptionSelection = true; currentOptionSelectionHandler = selectOption; foreach (var optionString in optionsCollection.Options) { string text = localisationProvider.GetLocalisedTextForLine(optionString.Line); ds.AddChoice(text, () => SelectOption(optionString.ID)); } onOptionsStart?.Invoke(); // Wait until the chooser has been used and then removed while (waitingForOptionSelection) { yield return(null); } onOptionsEnd?.Invoke(); }