Compare commits
No commits in common. "cafb8206e5beed6adfedee024344335b5289a596" and "e8d7c49a4e29d846443c49d0a90fa5ab84d9063f" have entirely different histories.
cafb8206e5
...
e8d7c49a4e
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
#include "EXPPickup.h"
|
#include "EXPPickup.h"
|
||||||
|
|
||||||
#include "PlayerCharacter.h"
|
|
||||||
|
|
||||||
void AEXPPickup::BeginPlay()
|
void AEXPPickup::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
@ -18,9 +16,7 @@ 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)
|
||||||
{
|
{
|
||||||
if (APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(OtherActor))
|
// TODO: Add EXP to player EXP component
|
||||||
{
|
|
||||||
PlayerCharacter->GetEXPComponent()->IncrementEXP(EXP);
|
Super::OnBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
|
||||||
Super::OnBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,7 @@ UCLASS()
|
||||||
class VAMPIRES_API AEXPPickup : public APickup
|
class VAMPIRES_API AEXPPickup : public APickup
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
|
||||||
int EXP = 1;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
@ -24,6 +21,6 @@ public:
|
||||||
virtual void Tick(float DeltaSeconds) override;
|
virtual void Tick(float DeltaSeconds) override;
|
||||||
|
|
||||||
virtual void OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
virtual void OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
||||||
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
|
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
|
||||||
const FHitResult& SweepResult) override;
|
const FHitResult& SweepResult) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
|
|
||||||
#include "GoldPickup.h"
|
#include "GoldPickup.h"
|
||||||
|
|
||||||
#include "PlayerCharacter.h"
|
|
||||||
|
|
||||||
class APlayerCharacter;
|
|
||||||
|
|
||||||
void AGoldPickup::BeginPlay()
|
void AGoldPickup::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
@ -20,9 +16,7 @@ void AGoldPickup::Tick(float DeltaSeconds)
|
||||||
void AGoldPickup::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
void AGoldPickup::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
||||||
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
|
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
|
||||||
{
|
{
|
||||||
if (APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(OtherActor))
|
// TODO: Add Gold to player Gold component
|
||||||
{
|
|
||||||
PlayerCharacter->GetGoldComponent()->IncrementGold(Gold);
|
Super::OnBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
|
||||||
Super::OnBeginOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,6 @@ class VAMPIRES_API AGoldPickup : public APickup
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
|
||||||
int Gold = 1;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
|
|
@ -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)
|
void APlayerCharacter::MovementCallback(const FInputActionInstance& Instance)
|
||||||
{
|
{
|
||||||
FVector2D vec2 = Instance.GetValue().Get<FVector2D>();
|
FVector2D vec2 = Instance.GetValue().Get<FVector2D>();
|
||||||
|
|
|
@ -67,10 +67,6 @@ protected:
|
||||||
public:
|
public:
|
||||||
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
||||||
|
|
||||||
UEXPComponent* GetEXPComponent();
|
|
||||||
|
|
||||||
UGoldComponent* GetGoldComponent();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void MovementCallback(const FInputActionInstance& Instance);
|
void MovementCallback(const FInputActionInstance& Instance);
|
||||||
|
|
Loading…
Reference in New Issue