Pokemon Unity Tutorial – More Pokemon Integration [Pt.5]

August 19, 2019

Unity Pokemon Tutorial

Class Data Management

Youtube – Lets Make… Pokemon in Unity! – Episode 5 – More Pokemon Integration

By: BrainStorm Games

This tutorial focused on creating the Player class and increasing the functionality of the BasePokemon class.

The Player class contained a list of OwnedPokemon, which was a newly created class within the Player script.

The BasePokemon class added some new features to work with evolution. The PokemonEvolution class was created, which held a BasePokemon that is the next evolution and an int for the level at which the evolution should occur. A PokemonEvolution variable was created within the BasePokemon class which would hold a reference to what pokemon a single one could evolve into.

There was also a lot done with the GameManager script. A PokemonMoves class was created that would provide the foundation for all the different types of attacks in the game, as well as a new MoveType enum, which categorized the moves (as physical, special, or status). There was also a Stat class that was created that just held a float for a minimum value and a float for the maximum value. The GameManager class itself also got a list of BasePokemon called allPokemon, and a list of PokemonMoves called allMoves. I am assuming these will just be used to hold some style of reference to every unique type of pokemon and move in the game.

The GameManager class also contained the methods for determining which Pokemon is randomly encountered in battles. A List method, GetPokemonByRarity, was created which basically takes an input of a Rarity enum and then looks through the current list of allPokemon and creates a new list with only those that have the same rarity value as designated by the input Rarity. Then another method, a BasePokemon method called GetRandomPokemonFromList, simply takes a BasePokemon list input (the list created by GetPokemonByRarity) and then randomly chooses one of the BasePokemon from that list and returns it. This combinations works to determine the specific pokemon encountered when calling a random encounter.

Again, things seem to be run a bit inefficiently (for example, populating this rarity list every time a battle is encountered) but I’ll be interested to see where it leads. This tutorial was a lot of setup that will make more sense once the system gets put in motion.