IncrementEXP when player overlaps
This commit is contained in:
parent
7f6e41cb50
commit
cafb8206e5
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "EXPPickup.h"
|
#include "EXPPickup.h"
|
||||||
|
|
||||||
|
#include "PlayerCharacter.h"
|
||||||
|
|
||||||
void AEXPPickup::BeginPlay()
|
void AEXPPickup::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
@ -16,7 +18,9 @@ void AEXPPickup::Tick(float DeltaSeconds)
|
||||||
void AEXPPickup::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
void AEXPPickup::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
||||||
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
|
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
|
||||||
{
|
{
|
||||||
// TODO: Add EXP to player EXP component
|
if (APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(OtherActor))
|
||||||
|
{
|
||||||
|
PlayerCharacter->GetEXPComponent()->IncrementEXP(EXP);
|
||||||
Super::OnBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
|
Super::OnBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,9 @@ class VAMPIRES_API AEXPPickup : public APickup
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
int EXP = 1;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue