Overhauled Items
Gave every single item a unique ID so no matter the item the ID will always be different
This commit is contained in:
parent
3360ea2031
commit
f52ea5efb8
BIN
Content/Blueprints/Items/BP_BuffJelly.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Items/BP_BuffJelly.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Items/BP_HealingJelly.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Items/BP_HealingJelly.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Player/BP_MyTempCharacter.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Player/BP_MyTempCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
@ -40,8 +40,12 @@ bool UInventoryComponent::AddItem(class UBaseItem* BaseItem)
|
||||
BaseItem->StoredItems = this;
|
||||
BaseItem->World = GetWorld();
|
||||
Items.Add(BaseItem);
|
||||
BaseItem->ItemID++;
|
||||
UE_LOG(LogTemp, Display, TEXT("ITEM HAS BEEN ADDED"));
|
||||
//Update UI
|
||||
//log the itemid
|
||||
UE_LOG(LogTemp, Display, TEXT("ITEM ID: %d"), BaseItem->ItemID);
|
||||
|
||||
//Refreshes the inventory
|
||||
OnInventoryUpdated.Broadcast();
|
||||
|
||||
return true;
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "Items/EatableItems.h"
|
||||
#include "InventoryComponent.generated.h"
|
||||
|
||||
//OUR DELEGATE IS CALLED FONINVENTORYUPDATED
|
||||
@ -33,6 +34,9 @@ public:
|
||||
UPROPERTY(EditDefaultsOnly, Category= "Inventory")
|
||||
int32 MaxItemSlots;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Inventory")
|
||||
int MaxItemStack;
|
||||
|
||||
UPROPERTY(BlueprintAssignable, Category= "Inventory")
|
||||
FOnInventoryUpdated OnInventoryUpdated; //This is our delegate
|
||||
|
||||
@ -41,4 +45,5 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category= "Inventory")
|
||||
class UBaseItem* GetItem(int Index);
|
||||
|
||||
};
|
||||
|
@ -52,6 +52,9 @@ public:
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Item")
|
||||
bool isDamageBuffItem;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Item")
|
||||
int ItemID;
|
||||
|
||||
//reference to the UInventoryComponent script
|
||||
UPROPERTY()
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
UEatableItems::UEatableItems()
|
||||
{
|
||||
|
||||
ItemID;
|
||||
}
|
||||
|
||||
void UEatableItems::Use(ATempCharacter* Character)
|
||||
|
Loading…
Reference in New Issue
Block a user