I try to override OnAcotrBeginOverlap.
Zone is parent class and DangerZone is child class.
I want my child class do the parent’s OnActorBeginOverlapEvent and also his.
the problem is, child class excutes parent’s function only.
this is Zone.cpp
void AZone::BeginPlay()
{
Super::BeginPlay();
CollisionMesh->OnComponentBeginOverlap.AddDynamic(this, &AZone::OnActorBeginOverlap);
}
void AZone::OnActorBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("%f"), eZone));
}
this is DangerZone.cpp
void ADangerZone::OnActorBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
Super::OnActorBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("sdfsdfsdf%f"), eZone));
}
void ADangerZone::BeginPlay()
{
CollisionMesh->OnComponentBeginOverlap.AddDynamic(this, &ADangerZone::OnActorBeginOverlap);
}