/// <summary> /// Verifica se o jogador colidiu ou passou por alguma resposta. /// </summary> private void CheckAnswer() { if (MistakesMade < AllowedMistakes) { if (foundAnswer != 0) { UpdateScoreAndQuestion(); } else if (!answeredAll) { QuestionGameObject question = questions[questions.Count - 1]; Answer a = question.GetClosestAnswer(); if (cam.ViewFrustum.Contains(a.BoundingBox) == ContainmentType.Disjoint && a.Z < player.Z) { if (question.CheckAnswer(a, true)) { perfectScoreMultiplier = 1; //a partir do momento que o jogador errou uma questão, não ganha mais o dobro de pontos MistakesMade++; AudioManager.GetCue("miss_answer_" + (PublicRandom.Next(2) + 1)).Play(); } question.MoveAnswer(a); } } } else if (!answeredAll) { answeredAll = true; foreach (QuestionGameObject q in questions) { goManager.RemoveObject(q); } } }
private void player_collidedWithAnswer(Answer answer) { if (questions[questions.Count - 1].CheckAnswer(answer, false)) { foundAnswer = 1; QuestionGameObject currentQuestion = questions[questions.Count - 1]; Score += currentQuestion.CurrentAnswerValue; scoreLbl.Text = Score.ToString(); if (string.IsNullOrEmpty(currentQuestion.Question.GetModifier(0))) { foreach (char c in answer.Text) { Vector3 position = answersSupports.GetClonePosition(answersGotLbl.Count); TextBox answerLbl = CreateLabel(c.ToString(), position); answerLbl.Y -= answersSupports.Height; answerLbl.Y -= answerLbl.Height; answersSupports.AdvanceCloneFrame(answersGotLbl.Count); answersGotLbl.Add(answerLbl); goManager.AddObject(answerLbl); } } else { Vector3 position = answersSupports.GetClonePosition(answersGotLbl.Count); TextBox answerLbl = CreateLabel(answer.Text, position); answerLbl.Y -= answersSupports.Height; answerLbl.Y -= answerLbl.Height; answersSupports.AdvanceCloneFrame(answersGotLbl.Count); answersGotLbl.Add(answerLbl); goManager.AddObject(answerLbl); } } else { if (answer.IsBonus) { Score++; } foundAnswer = -1; } }
private void ChangeCurrentQuestion() { QuestionGameObject answeredQuestion = questions[questions.Count - 1]; questions.RemoveAt(questions.Count - 1); goManager.RemoveObject(answeredQuestion); if (questions.Count > 0) { goManager.AddObject(questions[questions.Count - 1]); questions[questions.Count - 1].Position = new Vector3(0, 0.25f, player.Position.Z + 16); questions[questions.Count - 1].Player = player; questionHeader.Text = questions[questions.Count - 1].Header; ResetAnswersDisplay(); CreateAnswersSupports(); } else { ChangeBgm(bgmNames[bgmNames.Length - 1]); answeredAll = true; } }