The current class is REALLY messy, combining various tasks together. It handles fairly low-level hardware communication as well as higher-level, sometimes even game-specific functions like Hitpoints in one, big, bulky class.
I propose to split the class up into a few levels, potentially into modules that can be combined together as needed to get the right player behaviour:
A low-level class that handles direct communication with the lasertag set, and only the more barebones tasks
A "mid-level" class that provides standard functions that any game would use. This could include things like being killed by other players, hitpoints and ammunition handling, etc.
Optional modules for further functionality. Things like special abilities, shields and similar could be included into the player class this way, or at the very least proper data types (instead of a generic "data" hash) could be added.
The current class is REALLY messy, combining various tasks together. It handles fairly low-level hardware communication as well as higher-level, sometimes even game-specific functions like Hitpoints in one, big, bulky class.
I propose to split the class up into a few levels, potentially into modules that can be combined together as needed to get the right player behaviour: