示例#1
0
        public bool AllAnswered()
        {
            if (dragOnly || objectFlying || returnedAllAnswered)
            {
                return(false); // When antura is animating we should not complete the assessment
            }
            if (sortables == null)
            {
                return(false);
            }

            IAnswer[] answer       = new IAnswer[answers.Count];
            IAnswer[] answerSorted = new IAnswer[answers.Count];

            //Answers like are actually sorted
            var sorted = sortables.OrderByDescending(x => x.transform.position.x).ToArray();

            int index = 0;

            foreach (var a in answers)
            {
                answerSorted[index] = sorted[index].gameObject.GetComponent <AnswerBehaviour>().GetAnswer();
                index++;
            }

            // Answers sorted by ticket
            answer = answerSorted.OrderBy(a => a.GetTicket()).ToArray();

            for (int i = 0; i < answer.Length; i++)
            {
                Debug.Log("  answer:" + answer[i].Data().Id +
                          "  sorted:" + answerSorted[i].Data().Id);
            }

            for (int i = 0; i < answer.Length; i++)
            {
                //If sorted version has letter shapes in wrong positions we know we didn't find solution
                if (answer[i].Equals(answerSorted[i]) == false)
                {
                    return(false);
                }
            }

            //Debug.Log("Return TRUE");
            // two words identical!
            returnedAllAnswered = true;
            Coroutine.Start(AllCorrectCoroutine());
            return(true);
        }