public void OnAnswerClicked(string _key) { m_oGame.SetInIdle(false); //refresh the data (for graphics) RestoreQuestion(isCorrectAnswer(_key)); foreach (GameObject _obj in m_aoCurrentAnswerScene) { _obj.GetComponent <LetterBehaviour>().SetEnabledCollider(false); } //letter animation wait for ending dancing animation, wait animator fix LetterBehaviour clicked = GetAnswerById(_key); if (isCorrectAnswer(_key)) { clicked.PlayAnimation(LLAnimationStates.LL_still); clicked.mLetter.DoHorray(); PlayParticleSystem(m_aoCurrentQuestionScene[0].transform.position + Vector3.up * 2); m_oGame.StartCoroutine(Utils.LaunchDelay(0.5f, OnResponse, true)); } else { clicked.PlayAnimation(LLAnimationStates.LL_still); OnResponse(false); } }
void NextWordQuestion() { m_iRemovedLLDataIndex = 0; m_oCurrQuestionPack = MissingLetterConfiguration.Instance.Questions.GetNextQuestion(); ILivingLetterData questionData = m_oCurrQuestionPack.GetQuestion(); var _wrongAnswers = m_oCurrQuestionPack.GetWrongAnswers().ToList(); var _correctAnswer = m_oCurrQuestionPack.GetCorrectAnswers().ToList()[0]; GameObject oQuestion = m_oQuestionPool.GetElement(); LetterBehaviour qstBehaviour = oQuestion.GetComponent <LetterBehaviour>(); qstBehaviour.Reset(); qstBehaviour.LetterData = questionData; qstBehaviour.endTransformToCallback += qstBehaviour.Speak; qstBehaviour.onLetterBecameInvisible += OnQuestionLetterBecameInvisible; qstBehaviour.m_oDefaultIdleAnimation = LLAnimationStates.LL_idle; m_aoCurrentQuestionScene.Add(oQuestion); m_oEmoticonsController.init(qstBehaviour.transform); //after insert in mCurrentQuestionScene RemoveLetterfromQuestion(); GameObject _correctAnswerObject = m_oAnswerPool.GetElement(); LetterBehaviour corrAnsBheaviour = _correctAnswerObject.GetComponent <LetterBehaviour>(); corrAnsBheaviour.Reset(); corrAnsBheaviour.LetterData = _correctAnswer; corrAnsBheaviour.onLetterBecameInvisible += OnAnswerLetterBecameInvisible; corrAnsBheaviour.onLetterClick += OnAnswerClicked; corrAnsBheaviour.m_oDefaultIdleAnimation = m_bTutorialEnabled ? LLAnimationStates.LL_still : LLAnimationStates.LL_idle; m_aoCurrentAnswerScene.Add(_correctAnswerObject); m_oCorrectAnswer = _correctAnswerObject; for (int i = 1; i < m_oGame.m_iNumberOfPossibleAnswers && i < _wrongAnswers.Count() + 1; ++i) { GameObject _wrongAnswerObject = m_oAnswerPool.GetElement(); LetterBehaviour wrongAnsBheaviour = _wrongAnswerObject.GetComponent <LetterBehaviour>(); wrongAnsBheaviour.Reset(); wrongAnsBheaviour.LetterData = _wrongAnswers.ElementAt(i - 1); wrongAnsBheaviour.onLetterBecameInvisible += OnAnswerLetterBecameInvisible; if (!m_bTutorialEnabled) { wrongAnsBheaviour.onLetterClick += OnAnswerClicked; } wrongAnsBheaviour.m_oDefaultIdleAnimation = m_bTutorialEnabled ? LLAnimationStates.LL_still : LLAnimationStates.LL_idle; m_aoCurrentAnswerScene.Add(_wrongAnswerObject); } m_aoCurrentAnswerScene = m_aoCurrentAnswerScene.Shuffle(); }
void NextSentenceQuestion() { m_oCurrQuestionPack = MissingLetterConfiguration.Instance.Questions.GetNextQuestion(); List <LL_WordData> questionData = GetWordFromPhrases((LL_PhraseData)m_oCurrQuestionPack.GetQuestion()); var _correctAnswer = (LL_WordData)m_oCurrQuestionPack.GetCorrectAnswers().ToList()[0]; var _wrongAnswers = m_oCurrQuestionPack.GetWrongAnswers().ToList(); foreach (LL_WordData _word in questionData) { GameObject oQuestion = m_oQuestionPool.GetElement(); LetterBehaviour qstBehaviour = oQuestion.GetComponent <LetterBehaviour>(); qstBehaviour.Reset(); qstBehaviour.LetterData = _word; qstBehaviour.onLetterBecameInvisible += OnQuestionLetterBecameInvisible; qstBehaviour.m_oDefaultIdleAnimation = LLAnimationStates.LL_idle; qstBehaviour.SetInPhrase(m_oCurrQuestionPack.GetQuestion().Id); m_aoCurrentQuestionScene.Add(oQuestion); } //after insert in mCurrentQuestionScene m_iRemovedLLDataIndex = RemoveWordfromQuestion(questionData); m_aoCurrentQuestionScene[m_iRemovedLLDataIndex].GetComponent <LetterBehaviour>().endTransformToCallback += m_aoCurrentQuestionScene[m_iRemovedLLDataIndex].GetComponent <LetterBehaviour>().Speak; GameObject _correctAnswerObject = m_oAnswerPool.GetElement(); LetterBehaviour corrAnsBheaviour = _correctAnswerObject.GetComponent <LetterBehaviour>(); corrAnsBheaviour.Reset(); corrAnsBheaviour.LetterData = _correctAnswer; corrAnsBheaviour.onLetterBecameInvisible += OnAnswerLetterBecameInvisible; corrAnsBheaviour.onLetterClick += OnAnswerClicked; corrAnsBheaviour.m_oDefaultIdleAnimation = m_bTutorialEnabled ? LLAnimationStates.LL_still : LLAnimationStates.LL_idle; m_aoCurrentAnswerScene.Add(_correctAnswerObject); m_oCorrectAnswer = _correctAnswerObject; for (int i = 1; i < m_oGame.m_iNumberOfPossibleAnswers && i < _wrongAnswers.Count() + 1; ++i) { GameObject _wrongAnswerObject = m_oAnswerPool.GetElement(); LetterBehaviour wrongAnsBheaviour = _wrongAnswerObject.GetComponent <LetterBehaviour>(); wrongAnsBheaviour.Reset(); wrongAnsBheaviour.LetterData = _wrongAnswers.ElementAt(i - 1); wrongAnsBheaviour.onLetterBecameInvisible += OnAnswerLetterBecameInvisible; if (!m_bTutorialEnabled) { wrongAnsBheaviour.onLetterClick += OnAnswerClicked; } wrongAnsBheaviour.m_oDefaultIdleAnimation = m_bTutorialEnabled ? LLAnimationStates.LL_still : LLAnimationStates.LL_idle; m_aoCurrentAnswerScene.Add(_wrongAnswerObject); } m_aoCurrentAnswerScene = m_aoCurrentAnswerScene.Shuffle(); m_oEmoticonsController.init(m_aoCurrentQuestionScene[m_iRemovedLLDataIndex].transform); }