48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "EquipmentComponent.generated.h"
|
|
|
|
struct FGameplayTag;
|
|
class ABaseEquippable;
|
|
|
|
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
|
class D1_API UEquipmentComponent : public UActorComponent
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this component's properties
|
|
UEquipmentComponent();
|
|
|
|
protected:
|
|
// Called when the game starts
|
|
virtual void BeginPlay() override;
|
|
|
|
public:
|
|
// Called every frame
|
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
|
|
|
public:
|
|
void InitializeEquipment(UUserWidget* potionUI);
|
|
bool PerformActionFromItem(FGameplayTag ItemTag);
|
|
bool EquipItem(TSubclassOf<ABaseEquippable> InEquipment);
|
|
void UnequipItem(ABaseEquippable* EquipmentToUnequip);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
ABaseEquippable* GetEquippedItemByTag(FGameplayTag itemTag);
|
|
public:
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
|
|
TArray<TSubclassOf<ABaseEquippable>> StartingEquipment;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Default")
|
|
TArray<TObjectPtr<ABaseEquippable>> EquippedItems;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
|
TObjectPtr<UUserWidget> EquippedPotionUI;
|
|
};
|