2022-05-23 18:41:30 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Containers/Array.h"
|
|
|
|
#include "HAL/Platform.h"
|
|
|
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
|
|
|
#include "Templates/SubclassOf.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "UObject/Interface.h"
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "UObject/ScriptInterface.h"
|
|
|
|
#include "UObject/UObjectGlobals.h"
|
|
|
|
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "IPickupable.generated.h"
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
class AActor;
|
|
|
|
class ULyraInventoryItemDefinition;
|
2022-05-23 18:41:30 +00:00
|
|
|
class ULyraInventoryItemInstance;
|
|
|
|
class ULyraInventoryManagerComponent;
|
2022-09-13 07:18:28 +00:00
|
|
|
class UObject;
|
|
|
|
struct FFrame;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
USTRUCT(BlueprintType)
|
|
|
|
struct FPickupTemplate
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
int32 StackCount = 1;
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
TSubclassOf<ULyraInventoryItemDefinition> ItemDef;
|
|
|
|
};
|
|
|
|
|
|
|
|
USTRUCT(BlueprintType)
|
|
|
|
struct FPickupInstance
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
2022-09-13 07:18:28 +00:00
|
|
|
TObjectPtr<ULyraInventoryItemInstance> Item = nullptr;
|
2022-05-23 18:41:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
USTRUCT(BlueprintType)
|
|
|
|
struct FInventoryPickup
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
|
|
|
TArray<FPickupInstance> Instances;
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly)
|
|
|
|
TArray<FPickupTemplate> Templates;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** */
|
|
|
|
UINTERFACE(MinimalAPI, BlueprintType, meta = (CannotImplementInterfaceInBlueprint))
|
|
|
|
class UPickupable : public UInterface
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
};
|
|
|
|
|
|
|
|
/** */
|
|
|
|
class IPickupable
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
|
|
virtual FInventoryPickup GetPickupInventory() const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** */
|
|
|
|
UCLASS()
|
|
|
|
class UPickupableStatics : public UBlueprintFunctionLibrary
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
UPickupableStatics();
|
|
|
|
|
|
|
|
public:
|
2022-09-13 07:18:28 +00:00
|
|
|
UFUNCTION(BlueprintPure)
|
|
|
|
static TScriptInterface<IPickupable> GetFirstPickupableFromActor(AActor* Actor);
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, meta = (WorldContext = "Ability"))
|
2022-09-13 07:18:28 +00:00
|
|
|
static void AddPickupToInventory(ULyraInventoryManagerComponent* InventoryComponent, TScriptInterface<IPickupable> Pickup);
|
2022-05-23 18:41:30 +00:00
|
|
|
};
|