Add Weapon Inventory Component to Player Character

This commit is contained in:
baz 2024-07-18 01:40:09 +01:00
parent f25e6366f5
commit 8e1dd981ce
2 changed files with 13 additions and 7 deletions

View File

@ -38,6 +38,9 @@ APlayerCharacter::APlayerCharacter()
GarlicSphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("Garlic Sphere Component")); GarlicSphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("Garlic Sphere Component"));
GarlicSphereComponent->SetupAttachment(RootComponent); GarlicSphereComponent->SetupAttachment(RootComponent);
GarlicSphereComponent->SetSphereRadius(150.0f); GarlicSphereComponent->SetSphereRadius(150.0f);
//Create Weapon Inventory Component
WeaponInventoryComponent = CreateDefaultSubobject<UWeaponInventoryComponent>(TEXT("Weapon Inventory Component"));
} }
void APlayerCharacter::BeginPlay() void APlayerCharacter::BeginPlay()

View File

@ -7,6 +7,7 @@
#include "EXPComponent.h" #include "EXPComponent.h"
#include "GoldComponent.h" #include "GoldComponent.h"
#include "VampireCharacter.h" #include "VampireCharacter.h"
#include "WeaponInventoryComponent.h"
#include "Camera/CameraComponent.h" #include "Camera/CameraComponent.h"
#include "Components/SphereComponent.h" #include "Components/SphereComponent.h"
#include "GameFramework/SpringArmComponent.h" #include "GameFramework/SpringArmComponent.h"
@ -41,20 +42,22 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
float GarlicUpdateTime = 1.0f; float GarlicUpdateTime = 1.0f;
protected:
UPROPERTY()
UEXPComponent* EXPComponent;
UPROPERTY(VisibleAnywhere) UPROPERTY(VisibleAnywhere)
USphereComponent* GarlicSphereComponent; USphereComponent* GarlicSphereComponent;
UPROPERTY() UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<AEnemyCharacter*> OverlappedEnemies; TArray<AEnemyCharacter*> OverlappedEnemies;
UPROPERTY() UPROPERTY(EditAnywhere, BlueprintReadWrite)
UEXPComponent* EXPComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UGoldComponent* GoldComponent; UGoldComponent* GoldComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UWeaponInventoryComponent* WeaponInventoryComponent;
private: private:
FTimerHandle GarlicTimerHandle; FTimerHandle GarlicTimerHandle;