greenstack / spite-framework

The Spite Framework is a C# library meant to simplify designing and implementing turn-based gameplay by providing some boilerplate code.
MIT License
6 stars 0 forks source link

Make Arenas generic for teams #6

Closed greenstack closed 4 years ago

greenstack commented 4 years ago

Currently, when a team queries an arena for any team, it needs to cast the team into the expected team implementation. By making Arenas somewhat generic, like Arena<T> : IArena where T : ITeam, teams can reasonably query the Arena for teams without needing to cast to the specific type.

This will introduce several API changes and raises a few questions and concerns:

The following changes will also need to be made:

greenstack commented 4 years ago

Trying to make the Arenas fully generic ended up introducing more problems than it solved. Instead, Arena methods that query teams will instead have an optional generic version that allows the user to specify a specific type of team to retrieve. This places the responsibility of casting the team on the API instead of the end user. This also results in a smaller API change.