I have a question, maybe a noob question but I need to know before I go too in depth with my game. I’m making an RTS game in which the base class of every units and buildings is Actor.
After doing the building part and checking that everything is working fine with the inheritance, i’ve decided to do the unit part. But I came across a very deep conception problem, which is : unless I am wrong, I do need an AI controller to use moving functions from WheeledVehicleComponent (for tanks and trucks) and CharacterMovementComponent for infantries. BUT, as I’m using Actor as a base class, I can’t get a controller from that.
And even tho I could, I cannot inherit from both “PlayerUnit” and “WheeledVehicle”. I’m really in a dead-end here, if you guys have a solution, I would love to hear it !
the SelectableActor is a class where I put the health, max health, health bar (widgetComponent), the owner of the actor (which commander owns it) and create the mesh component of the actor (without loading anything, of course). SelectableActor split into PlayerActor and CivilianActor (which is not represented on the drawing). PlayerUnit contains stuff like the speed of the unit.
The only way I see is by duplicating a lot of code for multiple “blood lines”. For instance, doing a Building line with their own health, MaxHealth, etc, and do the exact same thing for another lane, let’s say the infantries. So that Buildings could be simple actors while infantry could start from Characters. That’s insanely dirty but I cannot think of another way