-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItem.h
More file actions
97 lines (75 loc) · 1.88 KB
/
Copy pathItem.h
File metadata and controls
97 lines (75 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/SphereComponent.h"
#include "InteractInterface.h"
#include "Components/WidgetComponent.h"
#include "UObject/UObjectGlobals.h"
#include "Item.generated.h"
// forward
class UInventoryComponent;
USTRUCT(BlueprintType)
struct FItemStruct
{
public:
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere)
FString name = "_item";
UPROPERTY(EditAnywhere)
FString description = "_desc";
UPROPERTY(EditAnywhere)
bool isStackable = false;
UPROPERTY(EditAnywhere)
bool isConsumable = false;
UPROPERTY(EditAnywhere)
UTexture2D* thumbnail = nullptr;
UPROPERTY(EditAnywhere)
uint32 maxStackSize = 1;
UPROPERTY(EditAnywhere)
UClass* itemClass = nullptr;
UPROPERTY(EditAnywhere)
uint32 consume = 0;
UPROPERTY(EditAnywhere)
uint32 value = 0;
UPROPERTY(EditAnywhere)
uint32 ownerFID = 0;
UPROPERTY(EditAnywhere)
UMaterial* material = nullptr;
UPROPERTY(EditAnywhere)
AItem* item_ref = nullptr;
};
USTRUCT()
struct FSlotStruct
{
public:
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere)
FItemStruct itemStruct = FItemStruct();
UPROPERTY(EditAnywhere)
uint32 quantity = 0;
};
UCLASS()
class RPG_CPP_API AItem : public AActor, public IInteractInterface
{
GENERATED_BODY()
public:
UPROPERTY()
USceneComponent* root;
UPROPERTY(EditAnywhere)
FItemStruct itemStruct;
UPROPERTY()
bool isInteracting;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UWidgetComponent* focusWidgetComponent;
// Sets default values for this actor's properties
AItem(const FObjectInitializer& OI);
bool useItem();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
void interact_Implementation(AActor* interactor) override;
};