So In my game I am thinking of allowing the player to change different classes; however, I am beginning to think that the way that I have set up my current class system isn’t very flexible.
My current system has a bunch of subclasses that extend from a interface, each player controller will a class variable that is changed over time as the player changes classes, but I’ve realized that if I want to implement something like a dodge roll, I would have to get the capsule collider of the player object, which is very hard to do with the current system.
I was thinking of doing something like this:
Class playerClass = new Class(this);
// Copy the playerController object into each class object
So I could get full access to all of the variables, but to me it doesn’t seem like a good idea.
How should I get about implementing a character class system that would allow for full flexibility of implementing various things? How do other games like TF2 or Overwatch do this?
Thanks.