- Home /
Need advice on Design
I would like to know whether I could improve this design.
Right now I'm thinking of having a User class which handles all inputs which will tell a HeroController class what to make the hero in the game view do (for example, moving left, right, jumping, etc.).
The Hero, friendly characters, and enemies will each have their own distinct class to represent them, but they will all inherit from a general Character class. Each distinct Character will also have its own distinct Controller. Of course, each distinct controller would inherit from a general Controller class.
Now here's where I get a little uncertain. I can't seem to see an obvious place to be updating things like health, exp, magic points, etc. These will have to be displayed in the game view. Should I isolate each of these into separate classes and have the character classes call on the appropriate methods in those classes? In short, the character clases would have a "has a" relationship with these health, magic, and other attribute classes.
Some advice on how to improve this or reassurance that this is solid would be great. My goal is an extendable design so I can avoid as much modification to pre-existing classes as I can later.
The forums are the best place for design questions. Ultimately OOP principles are typically the best design guides. Each object should accomplish one and only one task.
Your answer
![](https://koobas.hobune.stream/wayback/20220613160634im_/https://answers.unity.com/themes/thub/images/avi.jpg)