RealtimeStyleTransferRuntime/Source/LyraGame/AbilitySystem/LyraGlobalAbilitySystem.h

85 lines
2.5 KiB
C
Raw Normal View History

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 "Containers/Map.h"
#include "Containers/SparseArray.h"
2022-05-23 18:41:30 +00:00
#include "GameplayAbilitySpec.h"
2022-09-13 07:18:28 +00:00
#include "Subsystems/WorldSubsystem.h"
#include "Templates/SubclassOf.h"
#include "UObject/UObjectGlobals.h"
2022-05-23 18:41:30 +00:00
#include "LyraGlobalAbilitySystem.generated.h"
class UGameplayAbility;
2022-09-13 07:18:28 +00:00
class UGameplayEffect;
class ULyraAbilitySystemComponent;
class UObject;
struct FActiveGameplayEffectHandle;
struct FFrame;
struct FGameplayAbilitySpecHandle;
2022-05-23 18:41:30 +00:00
USTRUCT()
struct FGlobalAppliedAbilityList
{
GENERATED_BODY()
UPROPERTY()
2022-09-13 07:18:28 +00:00
TMap<TObjectPtr<ULyraAbilitySystemComponent>, FGameplayAbilitySpecHandle> Handles;
2022-05-23 18:41:30 +00:00
void AddToASC(TSubclassOf<UGameplayAbility> Ability, ULyraAbilitySystemComponent* ASC);
void RemoveFromASC(ULyraAbilitySystemComponent* ASC);
void RemoveFromAll();
};
USTRUCT()
struct FGlobalAppliedEffectList
{
GENERATED_BODY()
UPROPERTY()
2022-09-13 07:18:28 +00:00
TMap<TObjectPtr<ULyraAbilitySystemComponent>, FActiveGameplayEffectHandle> Handles;
2022-05-23 18:41:30 +00:00
void AddToASC(TSubclassOf<UGameplayEffect> Effect, ULyraAbilitySystemComponent* ASC);
void RemoveFromASC(ULyraAbilitySystemComponent* ASC);
void RemoveFromAll();
};
UCLASS()
class ULyraGlobalAbilitySystem : public UWorldSubsystem
{
GENERATED_BODY()
public:
ULyraGlobalAbilitySystem();
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category="Lyra")
void ApplyAbilityToAll(TSubclassOf<UGameplayAbility> Ability);
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category="Lyra")
void ApplyEffectToAll(TSubclassOf<UGameplayEffect> Effect);
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Lyra")
void RemoveAbilityFromAll(TSubclassOf<UGameplayAbility> Ability);
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Lyra")
void RemoveEffectFromAll(TSubclassOf<UGameplayEffect> Effect);
/** Register an ASC with global system and apply any active global effects/abilities. */
void RegisterASC(ULyraAbilitySystemComponent* ASC);
/** Removes an ASC from the global system, along with any active global effects/abilities. */
void UnregisterASC(ULyraAbilitySystemComponent* ASC);
private:
UPROPERTY()
TMap<TSubclassOf<UGameplayAbility>, FGlobalAppliedAbilityList> AppliedAbilities;
UPROPERTY()
TMap<TSubclassOf<UGameplayEffect>, FGlobalAppliedEffectList> AppliedEffects;
UPROPERTY()
2022-09-13 07:18:28 +00:00
TArray<TObjectPtr<ULyraAbilitySystemComponent>> RegisteredASCs;
2022-05-23 18:41:30 +00:00
};