Ejemplo n.º 1
0
        public CommitAnswerResult CommitAnswer(AnswerCode answer)
        {
            CommitAnswerResult answerResult = CurrentQuestion.CommitAnswer(answer, this);

            if (answerResult.WasAnswerCorrect)
            {
                var nextLevelKey = _activeLevelKey + 1;
                if (_gameLevels.Count >= nextLevelKey)
                {
                    SetActiveLevel(nextLevelKey);
                }
                else
                {
                    GameOver = true;
                    this.CurrentLevel.IsCompleted = true;
                    //.NET Ninja reached!!! Congratulation
                }
            }
            else
            {
                GameOver = true;
                //stop the game
            }

            return(answerResult);
        }
Ejemplo n.º 2
0
 private void DisplayAnswerResult(CommitAnswerResult commitAnswerResult)
 {
     if (commitAnswerResult.WasAnswerCorrect)
     {
         _gameView.Button(commitAnswerResult.UserAnswer).SetState(AnswerButtonState.CorrectAnswer);
         ServiceLocator.Sound.PlayEffect(gfx.SoundEffect.QuestionCommitted);
     }
     else
     {
         _gameView.Button(commitAnswerResult.UserAnswer).SetState(AnswerButtonState.WrongAnswer);
         _gameView.Button(commitAnswerResult.CorrectAnswer).SetState(AnswerButtonState.CorrectAnswer);
     }
 }