I want to structure my classes in a way that makes sense and is easily adaptable when implementing new types of units etc.
I was thinking that I’d have a base Class: Unit. This class would define the abstract interface for all the Units including players and AI.
I would then have three classes that Implement/Inherit from Unit. They would be the different elemental types of the Unit.
So i’d have the following:
- FireUnit : Unit
- WaterUnit: Unit
- EarthUnit: Unit
My problem is that I want players and AI units to act differently but still use the same Unit classes.
I can’t seem to get my head around how this would work.
Would Unit inherit from player? Or would player inherit from Unit?
Hopefully this makes sense, I’m quite new to OOP so I’m not even sure if i’m asking the right questions!