hello.
I am searching for this for a few days now but no certain answer I got.
How about magic attacks? punch and kick? grenades? throwing things like shuriken, spear and archery, land mine, laser and gravity guns?
They are all weapons right? Should I implement them all in the same base class?
it is better to have it as a mix of inheritance and actor components or what?
if I am planning to add mesh customization does it affect on my decision?
Thank you, but it cannot help me as I am asking about class hierarchy not firing mechanisms.
Discussed [here][1] and [here][2] but not enough for me to make up my mind.
I am currently thinking something like this, seems too weird though
I found this article accidentally, it does nor answer my question but it is interesting so I decided to post it here
Hmm, You made me think deeper and more serious on it.
I trapped in a more complex situation which is bothering me. What if you want to be able to throw a gun itself after you run out of bullets? I had to put that projectile movement component there in the base class because of it. then I thought the base class itself now can act as a bullet like thing.
in my diagram everything could be eventually thrown. (I want bullets to be projectile not trace, we need bullet drop).
Can you take a look at this. I want a kind of similar approach without losing inheritance advantages.
You helped me man. but I need more brain storm on it. can you discuses a bit more?
.
Did you receive my last reply? I am sure I sent it but I cannot see it here
Anyway, I said what if you want to throw the gun itself after you run out of bullets?
I had to put that MovementComponent there in the base class because of it.then I thought the base class now can act as a bullet like thing. in my diagram everything can be eventually thrown.
(I want bullets to be projectile not trace, we need bullet drop)
if you discuss a bit more on it I can make my mind
So, now you think my diagram will work for me?
Can you help me clean things up?
Look at this I want a kind of similar approach to it without losing inheritance advantages
So, I came across this idea:
Everything that can damage is a Weapon ( The gun itself and bullets also other melees).
Weapons all can be thrown and do a melee attack ( hitting with gun stock ) still very similar to my first diagram.
every weapon has a series of abilities (Actor components ) with the use of Actor components then I can combine abilities and making new weapons without having to change base classes.
for example a shotgun can be also a rocket launcher by adding this ability.
Weapon’s children only have to have meshes, animations and other cosmetics.
there will be a base class (Actor Component) for ability connected to weapon via a set of interface function ( OnStart() , OnComplete() , OnCancled() , CanStart() )
So nothing has to know anything about what an ability actually, just call them.
Without using actor components to grant abilities I would end up copy pasting too much of codes or regularly adding new features to the base class of any type of weapon .
Any ideas?
Some new infos here made me go even deeper