예제 #1
0
        private IEnumerator RoundsCoroutine(KoreCallback gameEndedCallback)
        {
            int anturaGagRound = Random.Range(1, Configuration.NumberOfRounds);

            for (int round = 0; round < Configuration.NumberOfRounds; round++)
            {
                // Show antura only on the elected round.
                if (anturaGagRound == round)
                {
                    yield return(Koroutine.Nested(AnturaGag()));
                }
                InitRound();

                yield return(Koroutine.Nested(RoundBegin()));

                yield return(Koroutine.Nested(PlaceAnswers()));

                LogicInjector.EnableDragOnly();

                if (round == 0)
                {
                    executingRound0 = true;
                    Koroutine.Run(DescriptionAudio());
                }

                yield return(Koroutine.Nested(GamePlay()));

                executingRound0 = false;
                yield return(Koroutine.Nested(ClearRound()));
            }

            gameEndedCallback();
        }
예제 #2
0
        private IEnumerator GamePlay()
        {
            LogicInjector.EnableGamePlay();

            while (LogicInjector.AllAnswersCorrect() == false)
            {
                yield return(null);
            }
        }
예제 #3
0
        private IEnumerator PlaceAnswers()
        {
            AnswerPlacer.Place(QuestionGenerator.GetAllAnswers());
            while (AnswerPlacer.IsAnimating())
            {
                yield return(null);
            }

            LogicInjector.AnswersAdded();
        }
예제 #4
0
        private void InitRound()
        {
            QuestionGenerator.InitRound();

            for (int question = 0; question < Configuration.SimultaneosQuestions; question++)
            {
                WireLogicInjector(LogicInjector, QuestionGenerator);
            }

            LogicInjector.CompleteWiring();

            QuestionGenerator.CompleteRound();
        }
예제 #5
0
        private IEnumerator ClearRound()
        {
            LogicInjector.RemoveDraggables();

            yield return(Koroutine.Nested(LogicInjector.AllAnsweredEvent()));

            QuestionPlacer.RemoveQuestions();
            AnswerPlacer.RemoveAnswers();

            while (QuestionPlacer.IsAnimating() || AnswerPlacer.IsAnimating())
            {
                yield return(null);
            }

            LogicInjector.ResetRound();
        }
        public IEnumerator PlayCoroutine(Action gameEndedCallback)
        {
            yield return(PlayStartSound());

            bool AnturaShowed = false;

            for (int round = 0; round < Configuration.Rounds; round++)
            {
                #region Init
                QuestionGenerator.InitRound();

                for (int question = 0; question < Configuration.SimultaneosQuestions; question++)
                {
                    LogicInjector.Wire(
                        QuestionGenerator.GetNextQuestion(),
                        QuestionGenerator.GetNextAnswers());
                }

                LogicInjector.CompleteWiring();
                LogicInjector.EnableDragOnly(); //as by new requirments

                //mute feedback audio while speaker is speaking
                bool answerConfigurationCache = AssessmentConfiguration.Instance.PronunceAnswerWhenClicked;
                AssessmentConfiguration.Instance.PronunceAnswerWhenClicked = false;

                QuestionGenerator.CompleteRound();
                #endregion

                if (AnturaShowed)
                {
                    // Show question only after antura animation is done.
                    QuestionPlacer.Place(QuestionGenerator.GetAllQuestions());
                    while (QuestionPlacer.IsAnimating())
                    {
                        yield return(null);
                    }
                }

                AnswerPlacer.Place(QuestionGenerator.GetAllAnswers());
                while (AnswerPlacer.IsAnimating())
                {
                    yield return(null);
                }

                LogicInjector.AnswersAdded();

                if (AnturaShowed == false)
                {
                    #region ANTURA ANIMATION

                    PlayAnturaIsComingSound();
                    var anturaController = AnturaFactory.Instance.SleepingAntura();

                    anturaController.StartAnimation(() => PlayPushAnturaSound(), () => PlayAnturaGoneSound());

                    while (anturaController.IsAnimating())
                    {
                        yield return(null);
                    }

                    yield return(TimeEngine.Wait(0.3f));

                    yield return(PlayGameDescription());

                    #endregion

                    QuestionPlacer.Place(QuestionGenerator.GetAllQuestions());
                    while (QuestionPlacer.IsAnimating())
                    {
                        yield return(null);
                    }

                    AnturaShowed = true;
                }

                #region GamePlay
                //////////////////////////////
                //// GAME LOGIC (WIP)
                ////----
                // Restore audio when playing
                AssessmentConfiguration.Instance.PronunceAnswerWhenClicked = answerConfigurationCache;
                LogicInjector.EnableGamePlay();

                while (LogicInjector.AllAnswersCorrect() == false)
                {
                    yield return(null);
                }
                ////___
                //// GAME LOGIC END
                //////////////////////////////

                LogicInjector.RemoveDraggables();

                QuestionPlacer.RemoveQuestions();
                AnswerPlacer.RemoveAnswers();

                while (QuestionPlacer.IsAnimating() || AnswerPlacer.IsAnimating())
                {
                    yield return(null);
                }

                LogicInjector.ResetRound();
                #endregion
            }

            gameEndedCallback();
        }