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->StoredItems = this;
|
||||||
BaseItem->World = GetWorld();
|
BaseItem->World = GetWorld();
|
||||||
Items.Add(BaseItem);
|
Items.Add(BaseItem);
|
||||||
|
BaseItem->ItemID++;
|
||||||
UE_LOG(LogTemp, Display, TEXT("ITEM HAS BEEN ADDED"));
|
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();
|
OnInventoryUpdated.Broadcast();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Components/ActorComponent.h"
|
#include "Components/ActorComponent.h"
|
||||||
|
#include "Items/EatableItems.h"
|
||||||
#include "InventoryComponent.generated.h"
|
#include "InventoryComponent.generated.h"
|
||||||
|
|
||||||
//OUR DELEGATE IS CALLED FONINVENTORYUPDATED
|
//OUR DELEGATE IS CALLED FONINVENTORYUPDATED
|
||||||
@ -33,6 +34,9 @@ public:
|
|||||||
UPROPERTY(EditDefaultsOnly, Category= "Inventory")
|
UPROPERTY(EditDefaultsOnly, Category= "Inventory")
|
||||||
int32 MaxItemSlots;
|
int32 MaxItemSlots;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, Category = "Inventory")
|
||||||
|
int MaxItemStack;
|
||||||
|
|
||||||
UPROPERTY(BlueprintAssignable, Category= "Inventory")
|
UPROPERTY(BlueprintAssignable, Category= "Inventory")
|
||||||
FOnInventoryUpdated OnInventoryUpdated; //This is our delegate
|
FOnInventoryUpdated OnInventoryUpdated; //This is our delegate
|
||||||
|
|
||||||
@ -41,4 +45,5 @@ public:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category= "Inventory")
|
UFUNCTION(BlueprintCallable, Category= "Inventory")
|
||||||
class UBaseItem* GetItem(int Index);
|
class UBaseItem* GetItem(int Index);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -52,6 +52,9 @@ public:
|
|||||||
|
|
||||||
UPROPERTY(EditAnywhere, Category = "Item")
|
UPROPERTY(EditAnywhere, Category = "Item")
|
||||||
bool isDamageBuffItem;
|
bool isDamageBuffItem;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Item")
|
||||||
|
int ItemID;
|
||||||
|
|
||||||
//reference to the UInventoryComponent script
|
//reference to the UInventoryComponent script
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
UEatableItems::UEatableItems()
|
UEatableItems::UEatableItems()
|
||||||
{
|
{
|
||||||
|
ItemID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UEatableItems::Use(ATempCharacter* Character)
|
void UEatableItems::Use(ATempCharacter* Character)
|
||||||
|
Loading…
Reference in New Issue
Block a user