public void PresentPRStatement() { Debug.Log(statement); if (statement == null) { statement = new PRStatement(); Sentence sentence = statement.getSentence(); string prefabPath = "WordGame/Word"; string teleprompterPath = "WordGame/Teleprompter"; string dropdownPath = "WordGame/Choice"; GameObject teleprompter = Instantiate(Resources.Load <GameObject>(teleprompterPath), menuCanvas.gameObject.transform); Transform wordParent = teleprompter.transform.Find("Panel/Viewport/Content/WordPanel"); // do unity loading stuff for UI here List <Word> words = sentence.getWords(); for (int i = 0; i < words.Count; i++) { Word word = words.ElementAt(i); // Display vanilla word if (!word.isOption()) { GameObject newVanillaWordObject = Instantiate(Resources.Load <GameObject>(prefabPath), wordParent.transform); WordUI ui = newVanillaWordObject.GetComponent <WordUI>(); ui.setText(word.getVanillaWord()); continue; } // Add choice dropdown GameObject newChoiceObject = Instantiate(Resources.Load <GameObject>(dropdownPath), wordParent.transform); ChoiceUI choiceObject = newChoiceObject.GetComponent <ChoiceUI>(); if (word.isOption()) { choiceObject.SetOptions(word.getChoice().options.Keys.ToList(), i); } choiceObject.enabled = true; } Transform ok = teleprompter.transform.Find("ButtonPanel").Find("OK"); Button okButton = ok.gameObject.GetComponent <Button>(); okButton.onClick.AddListener(delegate { okButton.onClick.RemoveAllListeners(); this.SubmitPrStatements(); this.RunRound(); Destroy(teleprompter); }); } }
public void RunRound() { if (presenterAnimator != null) { StartCoroutine(PresenterAnimationCoroutine()); } if (newRound) { statement = null; PresentPRStatement(); } GenerateFuckBucketPercentages(); RunAiTick(); RunDamageTick(); SpawnAi(); }