2022-11-14 14:57:02 +00:00
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
#include "Components/ActorComponent.h"
|
2022-11-29 14:15:20 +00:00
|
|
|
#include "Items/EatableItems.h"
|
2022-11-14 14:57:02 +00:00
|
|
|
#include "InventoryComponent.generated.h"
|
|
|
|
|
2022-11-14 17:42:26 +00:00
|
|
|
//OUR DELEGATE IS CALLED FONINVENTORYUPDATED
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnInventoryUpdated);
|
2022-11-14 14:57:02 +00:00
|
|
|
|
|
|
|
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:
|
2022-11-14 17:42:26 +00:00
|
|
|
bool AddItem(class UBaseItem* BaseItem); //adds the item to the player
|
|
|
|
|
|
|
|
bool Remove(class UBaseItem* BaseItem); //removes the item from the player
|
|
|
|
|
|
|
|
UPROPERTY(EditDefaultsOnly, Instanced)
|
|
|
|
TArray<class UBaseItem*> DefaultItems; //Items you start the game with IF YOU WANT YOU CAN JUST NOT USE THIS
|
|
|
|
|
|
|
|
UPROPERTY(EditDefaultsOnly, Category= "Inventory")
|
|
|
|
int32 MaxItemSlots;
|
|
|
|
|
2022-11-29 14:15:20 +00:00
|
|
|
UPROPERTY(EditDefaultsOnly, Category = "Inventory")
|
|
|
|
int MaxItemStack;
|
|
|
|
|
2022-11-14 17:42:26 +00:00
|
|
|
UPROPERTY(BlueprintAssignable, Category= "Inventory")
|
|
|
|
FOnInventoryUpdated OnInventoryUpdated; //This is our delegate
|
|
|
|
|
2022-11-18 13:07:44 +00:00
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category= "Items")
|
2022-11-14 17:42:26 +00:00
|
|
|
TArray<class UBaseItem*> Items; // The items currently in the inventory
|
2022-11-18 13:07:44 +00:00
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category= "Inventory")
|
2022-11-18 14:53:22 +00:00
|
|
|
class UBaseItem* GetItem(int Index);
|
2022-11-29 14:15:20 +00:00
|
|
|
|
2022-11-14 14:57:02 +00:00
|
|
|
};
|