OLS/Source/ols/Public/AbilitySystem/OLSGlobaAbilitySubsystem.h

65 lines
1.8 KiB
C
Raw Permalink Normal View History

2025-01-04 16:41:49 +00:00
// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
#pragma once
#include "CoreMinimal.h"
#include "Subsystems/WorldSubsystem.h"
#include "GameplayAbilitySpecHandle.h"
#include "ActiveGameplayEffectHandle.h"
#include "OLSGlobaAbilitySubsystem.generated.h"
USTRUCT()
struct FOLSGlobalAppliedAbilityList
{
GENERATED_BODY()
UPROPERTY()
TMap<TObjectPtr<class UOLSAbilitySystemComponent>, FGameplayAbilitySpecHandle> Handles;
void AddToASC(TSubclassOf<class UGameplayAbility> ability, class UOLSAbilitySystemComponent* asc);
void RemoveFromASC(class UOLSAbilitySystemComponent* asc);
void RemoveFromAll();
};
USTRUCT()
struct FOLSGlobalAppliedEffectList
{
GENERATED_BODY()
UPROPERTY()
TMap<TObjectPtr<class UOLSAbilitySystemComponent>, FActiveGameplayEffectHandle> Handles;
void AddToASC(const TSubclassOf<class UGameplayEffect>& effect, class UOLSAbilitySystemComponent* asc);
void RemoveFromASC(class UOLSAbilitySystemComponent* asc);
void RemoveFromAll();
};
/**
*
*/
UCLASS()
class OLS_API UOLSGlobaAbilitySubsystem : public UWorldSubsystem
{
GENERATED_BODY()
public:
/** Register an ASC with global system and apply any active global effects/abilities. */
void RegisterASC(class UOLSAbilitySystemComponent* asc);
/** Removes an ASC from the global system, along with any active global effects/abilities. */
void UnregisterASC(class UOLSAbilitySystemComponent* asc);
private:
UPROPERTY()
TMap<TSubclassOf<class UGameplayAbility>, FOLSGlobalAppliedAbilityList> AppliedAbilities;
UPROPERTY()
TMap<TSubclassOf<class UGameplayEffect>, FOLSGlobalAppliedEffectList> AppliedEffects;
UPROPERTY()
TArray<TObjectPtr<class UOLSAbilitySystemComponent>> RegisteredASCs;
};