コード例 #1
0
        protected void WrapQuestionInABox(IQuestion q)
        {
            var ll = q.gameObject.GetComponent <StillLetterBox>();
            int placeholdersCount = 0;

            foreach (var p in q.GetPlaceholders())
            {
                placeholdersCount++;
            }

            StillLetterBox[] boxes = new StillLetterBox[placeholdersCount + 1];

            placeholdersCount = 0;
            foreach (var p in q.GetPlaceholders())
            {
                boxes[placeholdersCount++] = p.GetComponent <StillLetterBox>();
            }
            boxes[boxes.Length - 1] = ll;

            var box = ItemFactory.Instance.SpawnQuestionBox(boxes);

            box.Show();
            audioManager.PlayPoofSound();

            boxesList.Add(box);
        }
コード例 #2
0
        private IEnumerator PlaceAnswer(Answer a)
        {
            var go = a.gameObject;

            go.GetComponent <StillLetterBox>().Poof();
            go.GetComponent <StillLetterBox>().Magnify();
            audioManager.PlayPoofSound();
            if (a.IsCorrect())
            {
                if (playbackAnswers.Count == 0 && AssessmentOptions.Instance.PlayCorrectAnswer)
                {
                    playbackAnswers.Add(a);
                }
                else if (AssessmentOptions.Instance.PlayAllCorrectAnswers)
                {
                    playbackAnswers.Add(a);
                }
            }

            yield return(Wait.For(Random.Range(0.07f, 0.13f)));
        }
コード例 #3
0
        private IEnumerator PlaceAnswer(Answer answer, List <Vector3> positions)
        {
            var go = answer.gameObject;

            go.transform.localPosition = positions.Pull();
            go.GetComponent <StillLetterBox>().InstaShrink();
            go.GetComponent <StillLetterBox>().Poof();
            go.GetComponent <StillLetterBox>().Magnify();
            audioManager.PlayPoofSound();
            if (answer.IsCorrect())
            {
                if (playbackAnswers.Count == 0 && AssessmentOptions.Instance.PlayCorrectAnswer)
                {
                    playbackAnswers.Add(answer);
                }
                else if (AssessmentOptions.Instance.PlayAllCorrectAnswers)
                {
                    playbackAnswers.Add(answer);
                }
            }

            yield return(Wait.For(Random.Range(0.07f, 0.13f)));
        }