// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "Subsystems/WorldSubsystem.h" #include "AbilitySystemInterface.h" #include "GameplayTagContainer.h" #include "GameplayAbilitySpec.h" #include "GameplayEffectTypes.h" #include "LyraGlobalAbilitySystem.generated.h" class ULyraAbilitySystemComponent; class UAbilitySystemComponent; class UGameplayEffect; class UGameplayAbility; USTRUCT() struct FGlobalAppliedAbilityList { GENERATED_BODY() UPROPERTY() TMap Handles; void AddToASC(TSubclassOf Ability, ULyraAbilitySystemComponent* ASC); void RemoveFromASC(ULyraAbilitySystemComponent* ASC); void RemoveFromAll(); }; USTRUCT() struct FGlobalAppliedEffectList { GENERATED_BODY() UPROPERTY() TMap Handles; void AddToASC(TSubclassOf 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 Ability); UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category="Lyra") void ApplyEffectToAll(TSubclassOf Effect); UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Lyra") void RemoveAbilityFromAll(TSubclassOf Ability); UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Lyra") void RemoveEffectFromAll(TSubclassOf 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, FGlobalAppliedAbilityList> AppliedAbilities; UPROPERTY() TMap, FGlobalAppliedEffectList> AppliedEffects; UPROPERTY() TArray RegisteredASCs; };