void CreateChoices(StoryPrompt prompt) { prompterChoices = new List <PrompterChoice>(); foreach (Transform choice in choiceRoot) { Destroy(choice.gameObject); } foreach (StoryChoice choice in prompt.Choices) { GameObject prompterPrefabInstance = Instantiate(PrompterChoicePrefab); prompterPrefabInstance.transform.SetParent(choiceRoot, false); PrompterChoice pc = prompterPrefabInstance.GetComponent <PrompterChoice>(); pc.AssignStoryChoice(choice); prompterChoices.Add(pc); } }
public void SelectChoiceByIndex(int index) { PrompterChoice choiceFab = prompterChoices[index]; choiceFab.OnPress(); }