Compare commits

..

No commits in common. "b8c22c9d3657e14e2809bdb84b29ac5448ae96ef" and "b2dc5b86f74cd6f203f3cde4f3c3f129a7768712" have entirely different histories.

2 changed files with 7 additions and 11 deletions

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

Binary file not shown.

View File

@ -3,7 +3,6 @@
#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()
@ -19,18 +18,15 @@ void ALevelKeyPickup::BeginPlay()
void ALevelKeyPickup::Tick(float DeltaTime) void ALevelKeyPickup::Tick(float DeltaTime)
{ {
Super::Tick(DeltaTime); Super::Tick(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()))) gameInstance->GetCurrentLevelManager()->IncrementCollectedLevelKeys();
{
gameInstance->GetCurrentLevelManager()->IncrementCollectedLevelKeys();
}
Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
} }
Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
} }