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:
parent
d29bb501c7
commit
e070b32f0e
BIN
Content/Levels/MerchantPrototype.umap
(Stored with Git LFS)
BIN
Content/Levels/MerchantPrototype.umap
(Stored with Git LFS)
Binary file not shown.
36
Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp
Normal file
36
Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp
Normal 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);
|
||||
|
||||
// ...
|
||||
}
|
||||
|
27
Source/the_twilight_abyss/BaseItems/InventoryComponent.h
Normal file
27
Source/the_twilight_abyss/BaseItems/InventoryComponent.h
Normal 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;
|
||||
};
|
4
Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp
Normal file
4
Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp
Normal file
@ -0,0 +1,4 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "BaseItem.h"
|
41
Source/the_twilight_abyss/BaseItems/Items/BaseItem.h
Normal file
41
Source/the_twilight_abyss/BaseItems/Items/BaseItem.h
Normal 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;
|
||||
};
|
Loading…
Reference in New Issue
Block a user