Compare commits

...

2 Commits

Author SHA1 Message Date
baz b8c22c9d36 2024/4/9 Level1 Updates 2024-04-10 01:29:27 +01:00
baz c0d57dac8e Check for Player in OnOverlapBegin on ALevelKeyPickup 2024-04-10 01:28:51 +01:00
2 changed files with 11 additions and 7 deletions

BIN
Content/Levels/Level1/Level1.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -3,6 +3,7 @@
#include "LevelKeyPickup.h" #include "LevelKeyPickup.h"
#include "NakatomiGameInstance.h" #include "NakatomiGameInstance.h"
#include "PlayerCharacter.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
void ALevelKeyPickup::BeginPlay() void ALevelKeyPickup::BeginPlay()
@ -22,6 +23,8 @@ void ALevelKeyPickup::Tick(float DeltaTime)
void ALevelKeyPickup::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, void ALevelKeyPickup::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (Cast<APlayerCharacter>(OtherActor))
{ {
if (auto gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()))) if (auto gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld())))
{ {
@ -30,3 +33,4 @@ void ALevelKeyPickup::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, A
Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult); Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
} }
}