void Update() { if (!initialized) { TopicIndicator[] indicators = GameObject.Find("TopicIndicators").GetComponentsInChildren <TopicIndicator>(); foreach (TopicIndicator topicIndicator in indicators) { topicIndicators.Add(topicIndicator.topic, topicIndicator); } foreach (string topic in dialogueParser.dialogue.Keys) { topicScores[topic] = new TopicScore(0, 0); topicIndicators[topic].topicScore = topicScores[topic]; } answerBox.text = ""; PrepareAnswers(); initialized = true; setDialogueOptions(getRandomQuestions()); } if (Input.GetMouseButtonDown(0) && choiceOptionPicked != null) { mouseButtonWasDown = true; } else if (Input.GetMouseButtonUp(0) && choiceOptionPicked != null && mouseButtonWasDown) { Debug.Log("I shall update"); UpdateDialogue(); Debug.Log("I have updated"); mouseButtonWasDown = false; } }
public void OptionPicked(DialogueOptionPanel optionPanel) { if (choiceOptionPicked == null) { DialogueOption dialogueOption = optionPanel.dialogueOption; answerBox.text = dialogueOption.answer; TopicScore score = topicScores[dialogueOption.topic]; score.total++; score.currentScore += dialogueOption.modifier; printScore(); choiceOptionPicked = optionPanel; } }
private void printScore() { TopicScore totals = new TopicScore(0, 0); string result = ""; foreach (KeyValuePair <string, TopicScore> score in topicScores) { result += "\n" + score.Key + ": total=" + score.Value.total + " score=" + score.Value.currentScore; totals.total += score.Value.total; totals.currentScore += score.Value.currentScore; } float x = 1 - (float)totals.currentScore / totals.total; GameObject theWoman = GameObject.Find("the-woman"); Debug.Log("AND THE SCOPRE IS!!! "); print("" + x); theWoman.GetComponent <TheWoman>().status = x; result = "Totals: total=" + totals.total + " score=" + totals.currentScore + result; print(result); }
public static TopicScore CreateTopicScore(int assessmentKey, int assessmentAttemptNumber, int participantKey, short dataSourceKey, int score, int topicMaximumScore, double topicPercentageScore, int topicQuestionCount, int topicKey, string tenantId, int groupGroupKey) { TopicScore topicScore = new TopicScore(); topicScore.AssessmentKey = assessmentKey; topicScore.AssessmentAttemptNumber = assessmentAttemptNumber; topicScore.ParticipantKey = participantKey; topicScore.DataSourceKey = dataSourceKey; topicScore.Score = score; topicScore.TopicMaximumScore = topicMaximumScore; topicScore.TopicPercentageScore = topicPercentageScore; topicScore.TopicQuestionCount = topicQuestionCount; topicScore.TopicKey = topicKey; topicScore.TenantId = tenantId; topicScore.GroupGroupKey = groupGroupKey; return topicScore; }
public void AddToTopicScores(TopicScore topicScore) { base.AddObject("TopicScores", topicScore); }