cooper37
(cooper37)
January 9, 2019, 11:06pm
8
AlexQuevillon:
To answer your question, no. Not if your reference is the last child of the hierarchy (assuming they are all in a linear inheritance).
e.g. You have create a custom blueprint actor class. When you place this actor into the world, you don’t need to cast it into Actor before calling the function GetActorLocation() because it is inside its parent.
And, in my head I had something more like: Jump -> DoubleJump -> GroundPound -> Glide
And you are using Glide (Because it is the last child)
But, that said, I’m not sure it is the best strategy for this. (I’m really not sure that my suggestion is the best because I only thought about it for 5 minutes, but here it is.)
If you want to separate all your actions into multiple components, I think it is probably better to only use inheritance on components that uses the same functionnalities (like Jump and DoubleJump).
And have an higher level manager that will decide if the current character can call the DoubleJump component instead of the Jump one.
In shot, not saving the ‘‘CanDoubleJump’’ variable inside the component, but inside the manager that make the decision of which component to execute.
And instead of adding components based on the progression, you can simply add all of them to your actor and then simply ‘‘Activate’’ them in the manager when unlocked.
Or something like that.
Or maybe simply have 1 component that contains all the possible actions, but I’m really not sure about this one ^^’
I was thinking the same thing with the whole concept of adding all the components then turning them on and off…the whole manager thing will take some thinking, especially if I want it to look clean and understandable to add and remove abilities. As far as I know right now, Jump and Double Jump are the only abilities that’s similar, might as well suck it up and put them into the same component for simplicity sake.
I’ll move some things around and report back my best findings.