Move WeaponInventoryComponent to base character class

This commit is contained in:
baz 2024-11-22 00:22:21 +00:00
parent eae0dbb802
commit dc5e4bb3a2
4 changed files with 8 additions and 6 deletions

View File

@ -39,9 +39,6 @@ APlayerCharacter::APlayerCharacter()
// Create Gold Component
GoldComponent = CreateDefaultSubobject<UGoldComponent>(TEXT("Gold Component"));
//Create Weapon Inventory Component
WeaponInventoryComponent = CreateDefaultSubobject<UWeaponInventoryComponent>(TEXT("Weapon Inventory Component"));
// Create HealthBar Widget Component
HealthBarWidgetComponent = CreateDefaultSubobject<UWidgetComponent>(TEXT("Healthbar"));
HealthBarWidgetComponent->SetupAttachment(RootComponent);

View File

@ -37,9 +37,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UGoldComponent* GoldComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UWeaponInventoryComponent* WeaponInventoryComponent;
FVector2D PreviousMovementDirection = FVector2d(1.0f, 0.0f);
UPROPERTY(EditAnywhere)

View File

@ -5,6 +5,7 @@
#include "HealthComponent.h"
#include "PaperFlipbookComponent.h"
#include "WeaponInventoryComponent.h"
// Sets default values
AVampireCharacter::AVampireCharacter()
@ -19,6 +20,9 @@ AVampireCharacter::AVampireCharacter()
PaperFlipbookComponent->SetRelativeRotation(FRotator(0.0f, 90.0f,-90.0f));
PaperFlipbookComponent->SetRelativeScale3D(FVector(0.2f, 0.2f, 0.2f));
PaperFlipbookComponent->SetupAttachment(RootComponent);
//Create Weapon Inventory Component
WeaponInventoryComponent = CreateDefaultSubobject<UWeaponInventoryComponent>(TEXT("Weapon Inventory Component"));
}
// Called when the game starts or when spawned

View File

@ -7,6 +7,7 @@
#include "GameFramework/Character.h"
#include "VampireCharacter.generated.h"
class UWeaponInventoryComponent;
class UInputAction;
class UHealthComponent;
class UPaperFlipbookComponent;
@ -26,6 +27,9 @@ protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TObjectPtr<UInputMappingContext> InputMappingContext;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UWeaponInventoryComponent* WeaponInventoryComponent;
public:
// Sets default values for this character's properties