Files
ProjectEleri/Source/ProjectEleri/GameplayAbilities/EleriAbilitySystemComponent.h
2026-07-11 10:43:52 +02:00

60 lines
2.0 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemComponent.h"
#include "EleriAbilitySystemComponent.generated.h"
class UGameplayEffect;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAttributeChange, FGameplayAttribute, GameplayAttribute, float, NewValue, float, OldValue);
UENUM(BlueprintType)
enum class EProfessionType : uint8 {
ALCHEMY UMETA(DisplayName="Alchemy"),
BOTANY UMETA(DisplayName = "Botany"),
GATHERING UMETA(DisplayName = "Gathering"),
FLYING UMETA(DisplayName = "Flying"),
MAX UMETA(Hidden)
};
/**
*
*/
UCLASS()
class PROJECTELERI_API UEleriAbilitySystemComponent : public UAbilitySystemComponent
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
TArray<TSubclassOf<UGameplayEffect>> InitialEffects;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
TMap<EProfessionType, TSubclassOf<UGameplayEffect>> ProfessionModifierEffects;
UPROPERTY(BlueprintAssignable)
FOnAttributeChange OnAttributeChange;
UFUNCTION(BlueprintCallable, Category = "Eleri Ability System", meta = (WorldContext = "WorldContextObject"))
static void AddExp(UObject* WorldContextObject, FGameplayAttribute GameplayAttribute, float Amount);
UFUNCTION(BlueprintCallable, Category = "Eleri Ability System", meta = (WorldContext = "WorldContextObject"))
static void AddProfessionExp(UObject* WorldContextObject, EProfessionType Profession, float Amount);
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri Ability System", meta = (WorldContext = "WorldContextObject"))
static int32 GetProfessionLevel(UObject* WorldContextObject, EProfessionType Profession);
protected:
UPROPERTY()
TMap<EProfessionType, FActiveGameplayEffectHandle> ProfessionModifierEffectsContainer;
virtual void BeginPlay() override;
void AttributeChanged(const FOnAttributeChangeData& AttributeChangeData);
static FGameplayAttribute GetGameplayAttributeForProfession(EProfessionType Profession);
};