In the gun class, we write
OutHit.GetActor()->TakeDamage(DamageAmount, DamageEvent, OwnerController, this);
Whereas in the Shooter Character we write:
float DamageApplied = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser) which is called on a pawn.
My question is how does Unreal know to cll the TakeDamage() function in our Shooter Character class when we call it on the getactor()? I’ve been struggling with this for a while and wanted to clear it. I think it’s more than just virtual function and so. It would’ve made sense if we got the ShooterCharacter object but it’s through the actor and from what I know so far, base classes can’t call funcitons of child classes.
Does it have to do with events and delegates?