Example #1
0
    public void GeneratePokemonQuestions(string pokemonName)
    {
        PokemonSpeciesDataObject pokeDTO = PokemonAPIHelper.GetPokemon(pokemonName);

        if (pokeDTO != null)
        {
            Setup();
            QueueQuestion(pokeDTO, QuestionType.Name);
            QueueQuestion(pokeDTO, QuestionType.EggGroup);
            QueueQuestion(pokeDTO, QuestionType.FlavorText);
            QueueQuestion(pokeDTO, QuestionType.Generation);
            QueueQuestion(pokeDTO, QuestionType.PokedexNumber);
            GetComponent <QuestionsController>().SetSprite(pokeDTO.PokedexNumber);
            GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>().SetGameState(GameState.Playing);
            GetComponent <QuestionsController>().NextQuestion();
        }
    }
Example #2
0
    public void QuestionSetup(PokemonSpeciesDataObject pokeObj, QuestionType type)
    {
        switch (type)
        {
        case QuestionType.EggGroup:
            Question         = "What egg group does " + pokeObj.Name + " belong to?";
            Answer           = PokemonEggGroup.FormatName(pokeObj.EggGroups[0].Name);
            Choices          = GetRandomChoices(Answer, PokemonAPIQuestionGenerator.EggGroups);
            IsMultipleChoice = true;
            break;

        case QuestionType.Generation:
            Question         = "What generation of games is " + pokeObj.Name + " from?";
            Answer           = PokemonGeneration.FormatName(pokeObj.Generation.Name);
            Choices          = GetRandomChoices(Answer, PokemonAPIQuestionGenerator.Generations);
            IsMultipleChoice = true;
            break;

        case QuestionType.PokedexNumber:
            Question         = "What number of the national pokedex is " + pokeObj.Name + "?";
            Answer           = pokeObj.PokedexNumber.ToString();
            IsMultipleChoice = false;
            break;

        case QuestionType.Name:
            Question         = "Who is that Pokemon?";
            Answer           = pokeObj.Name;
            Answer           = char.ToUpper(Answer[0]) + Answer.Substring(1);
            IsMultipleChoice = false;
            break;

        case QuestionType.FlavorText:
            string[] fixedUp = RemoveWord(pokeObj.FlavorTexts.Where(ft => ft.Language.Name == "en").Take(1).Select(ft => ft.FlavorText).SingleOrDefault());
            Answer           = fixedUp[0];
            Question         = "Fill in the blanks.\n" + fixedUp[1];
            IsMultipleChoice = false;
            break;
        }
    }
Example #3
0
 public PokemonQuestion(PokemonSpeciesDataObject pokemonObj, QuestionType type)
 {
     QuestionType = type;
     QuestionSetup(pokemonObj, type);
     PokemonName = pokemonObj.Name;
 }
Example #4
0
 public void QueueQuestion(PokemonSpeciesDataObject dataObj, QuestionType type)
 {
     Questions.Enqueue(new PokemonQuestion(dataObj, type));
 }