// Use this for initialization protected virtual void Awake() { this.controller = GameObject.Find("QuizController").GetComponent <QuizController>(); foreach (GameGUIText guiText in this.transform.GetComponentsInChildren <GameGUIText>()) { if (guiText.gameObject.name == "QuestionText") { questionText = guiText; } if (guiText.gameObject.name == "OptionA") { optionAText = guiText; } if (guiText.gameObject.name == "OptionB") { optionBText = guiText; } } foreach (ImageView guiText in this.transform.GetComponentsInChildren <ImageView>()) { switch (guiText.gameObject.name) { case "ImageViewA": optionAImg = guiText; break; case "ImageViewB": optionBImg = guiText; break; } } }
protected override void Awake() { base.Awake(); foreach (GameGUIText guiText in this.transform.GetComponentsInChildren <GameGUIText>()) { switch (guiText.gameObject.name) { case "ButtonA": buttonAText = guiText; break; case "ButtonB": buttonBText = guiText; break; } } if (buttonAText == null) { Debug.LogWarning("BUTTON A NO GO!!"); } if (buttonBText == null) { Debug.LogWarning("BUTTON B NO GO!!"); } }
protected override void Awake() { base.Awake(); foreach (GameGUIText guiText in this.transform.GetComponentsInChildren <GameGUIText>()) { switch (guiText.gameObject.name) { case "ChoiceA": choiceA = guiText; break; case "ChoiceB": choiceB = guiText; break; case "ChoiceC": choiceC = guiText; break; } } choices.Add(choiceA); choices.Add(choiceB); choices.Add(choiceC); }
void Awake() { this.score = 0; this.header = GameObject.Find("GameGUIHeader").GetComponent <GameGUIText>(); this.scoreText = GameObject.Find("ScoreHeader").GetComponent <GameGUIText> (); this.scoreText.SetTextPure("Score: " + 0); this.cat = GameObject.Find("CatObject"); this.catStates = new Dictionary <string, GameObject> { { "Happy", GameObject.Find("HappyCat") }, { "Neutral", GameObject.Find("NeutralCat") }, { "Sad", GameObject.Find("SadCat") }, }; this.catStates ["Happy"].SetActive(false); this.catStates ["Sad"].SetActive(false); foreach (QuizView view in GameObject.FindObjectsOfType <QuizView>()) { quizViews.Add(view); switch (view.gameObject.name) { case "CompositionQuizView": compositionQuizView = view; this.cat.transform.parent = compositionQuizView.transform; this.cat.transform.position = Vector3.zero; break; case "CompareQuizView": compareQuizView = view; this.cat.transform.parent = compareQuizView.transform; this.cat.transform.position = Vector3.zero; break; } } if (compositionQuizView == null) { Debug.LogWarning("No composition view!"); } if (compareQuizView == null) { Debug.LogWarning("No compare view!"); } }
public override void DetectClick(GameGUIText text) { if (clicked) { return; } clicked = true; text.renderer.material.color = Color.red; bool winnerIsA = currentQuestion.foodA.amount > currentQuestion.foodB.amount; bool choosenA = text.name == "ButtonA"; GameGUIText winner = winnerIsA ? buttonAText : buttonBText; winner.renderer.material.color = Color.green; float result = winnerIsA == choosenA ? 1f : 0f; TimerManager.instance.StartTimer(delegate { this.controller.AnswerQuestion(result); }, 1); }
public override void DetectClick(GameGUIText text) { if (clicked) { return; } clicked = true; text.renderer.material.color = Color.red; foreach (GameGUIText t in choices) { if (t.value == q.actualValue) { t.renderer.material.color = Color.green; } } float result = text.value == q.actualValue ? 1f : 0f; TimerManager.instance.StartTimer(delegate { this.controller.AnswerQuestion(result); }, 1); }
public virtual void DetectClick(GameGUIText text) { }