Created BaseItem and InventoryComponent for Items

Created both the baseitem and inventorycomponent class to start adding in the custom items to the game.
This commit is contained in:
MH261677 2022-11-14 14:57:02 +00:00
parent d29bb501c7
commit e070b32f0e
5 changed files with 110 additions and 2 deletions

BIN
Content/Levels/MerchantPrototype.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -0,0 +1,36 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "InventoryComponent.h"
// Sets default values for this component's properties
UInventoryComponent::UInventoryComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UInventoryComponent::BeginPlay()
{
Super::BeginPlay();
// ...
}
// Called every frame
void UInventoryComponent::TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}

View File

@ -0,0 +1,27 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "InventoryComponent.generated.h"
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class THE_TWILIGHT_ABYSS_API UInventoryComponent : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UInventoryComponent();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction) override;
};

View File

@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "BaseItem.h"

View File

@ -0,0 +1,41 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "BaseItem.generated.h"
/**
*
*/
UCLASS(Abstract, BlueprintType, Blueprintable, EditInlineNew, DefaultToInstanced)
class THE_TWILIGHT_ABYSS_API UBaseItem : public UObject
{
GENERATED_BODY()
public:
//The text that will be displayed for using the item (Equip, Eat)
UPROPERTY(EditDefaultsOnly,BlueprintReadWrite, Category = "Item")
FText ItemUseAction;
//The actual mesh of the item
UPROPERTY(EditDefaultsOnly,BlueprintReadWrite, Category = "Item")
class UStaticMesh* ItemMesh;
//The picture of the item icon
UPROPERTY(EditDefaultsOnly,BlueprintReadWrite, Category = "Item")
class UTexture2D* ItemIcon;
//The name of the item
UPROPERTY(EditDefaultsOnly,BlueprintReadWrite, Category = "Item")
FText ItemDisplayName;
//The description of the item
UPROPERTY(EditDefaultsOnly,BlueprintReadWrite, Category = "Item")
FText ItemDescription;
//reference to the UInventoryComponent script
UPROPERTY()
class UInventoryComponent* StoredItems;
};