StarCraft map battles. after entering the map within five seconds, each player will have a base, a few farmers, and an initial population supply. But these are different based on race. Problem to be solved: We need to initialize players based on different races. It is best to encapsulate these different processing methods. StarCraft map battles. after entering the map within five seconds, each player will have a base, a few farmers, and an initial population supply. But these are different based on race.
Problem to be solved: We need to initialize players based on different races. It is best to encapsulate these different processing methods.
Idea: Define the initialization interface and create initialization classes of different races.
Strategy example:
To prevent code from being too long, some classes are not defined here. To debug the code, replace new with a string.