Download

Health and Selection Circle... Inheritance

I am working on an RTS and created “Units” Class which handles Health/damage and Selection Circle for Units and is derived off of the “Character” class

I want to create “Buildings” which should also have Health and is Selectable, but it does not need the skeletal mesh or any of the functions which are added by the Character Class… But, has to support some kind of basic AI…so, I want to use a Pawn class.

After thinking of this and digging through the code a bit, I noticed that Character class inherits from Pawn, and Pawn from Actor.
Is there a way that I could create a custom Character so that the custom character derives from the custom pawn which also derives from the custom actor so that this actor handles the Health/Damage/Unit Selection?

This way… I can have buildings, like turrets which require AI, be pawn controlled/posssessed by AI and Miscellaneous objects like destructible crates/boxes be actors. Which all have health, and so is destructable, and is able to be selected

If not, what are possible solution to this problem without needing to copy and paste the code which handles health/unit selection from the character over to pawns/actors?