Looking for advice on best practice.
I have a fluent builder class (reduced complexity to highlight issue)
public class GameBuilder : IGameBuilder
{
private readonly Game : game;
public Game AddPlayers(List<Player> players)
{
game.SetPlayers(players);
return this;
}
public Game Build()
{
game.Initialise();
return game;
}
}
This is great as I can build up a game with different arguments. Now unfortunately my SME told me that I can have a game with Supremo Players.
Supremo Players have extra data associated with their class so immediately I thought no problems I will inherit from Player but I'm not sure if this is right. I guess I could use generics on the builder but I would need an example to help me :)
The rules: A game can only have one type of player The player type is known at constructor time.
Any guidance appreciated.
Aucun commentaire:
Enregistrer un commentaire