Compare commits

..

No commits in common. "cafb8206e5beed6adfedee024344335b5289a596" and "e8d7c49a4e29d846443c49d0a90fa5ab84d9063f" have entirely different histories.

6 changed files with 9 additions and 41 deletions

View File

@ -3,8 +3,6 @@
#include "EXPPickup.h"
#include "PlayerCharacter.h"
void AEXPPickup::BeginPlay()
{
Super::BeginPlay();
@ -18,9 +16,7 @@ void AEXPPickup::Tick(float DeltaSeconds)
void AEXPPickup::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(OtherActor))
{
PlayerCharacter->GetEXPComponent()->IncrementEXP(EXP);
// TODO: Add EXP to player EXP component
Super::OnBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
}
}

View File

@ -14,9 +14,6 @@ class VAMPIRES_API AEXPPickup : public APickup
{
GENERATED_BODY()
public:
int EXP = 1;
protected:
virtual void BeginPlay() override;

View File

@ -3,10 +3,6 @@
#include "GoldPickup.h"
#include "PlayerCharacter.h"
class APlayerCharacter;
void AGoldPickup::BeginPlay()
{
Super::BeginPlay();
@ -20,9 +16,7 @@ void AGoldPickup::Tick(float DeltaSeconds)
void AGoldPickup::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(OtherActor))
{
PlayerCharacter->GetGoldComponent()->IncrementGold(Gold);
// TODO: Add Gold to player Gold component
Super::OnBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
}
}

View File

@ -14,11 +14,6 @@ class VAMPIRES_API AGoldPickup : public APickup
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
int Gold = 1;
protected:
virtual void BeginPlay() override;

View File

@ -74,16 +74,6 @@ void APlayerCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCom
}
}
UEXPComponent* APlayerCharacter::GetEXPComponent()
{
return EXPComponent;
}
UGoldComponent* APlayerCharacter::GetGoldComponent()
{
return GoldComponent;
}
void APlayerCharacter::MovementCallback(const FInputActionInstance& Instance)
{
FVector2D vec2 = Instance.GetValue().Get<FVector2D>();

View File

@ -67,10 +67,6 @@ protected:
public:
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
UEXPComponent* GetEXPComponent();
UGoldComponent* GetGoldComponent();
private:
UFUNCTION()
void MovementCallback(const FInputActionInstance& Instance);