86 lines
2.1 KiB
C
86 lines
2.1 KiB
C
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include "CoreMinimal.h"
|
||
|
#include "Subsystems/WorldSubsystem.h"
|
||
|
#include "Engine/DeveloperSettings.h"
|
||
|
#include "GameplayTagContainer.h"
|
||
|
#include "PhysicalMaterials/PhysicalMaterial.h"
|
||
|
|
||
|
#include "LyraContextEffectsSubsystem.generated.h"
|
||
|
|
||
|
class ULyraContextEffectsLibrary;
|
||
|
class UNiagaraComponent;
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
UCLASS(config = Game, defaultconfig, meta = (DisplayName = "LyraContextEffects"))
|
||
|
class LYRAGAME_API ULyraContextEffectsSettings : public UDeveloperSettings
|
||
|
{
|
||
|
GENERATED_BODY()
|
||
|
|
||
|
public:
|
||
|
//
|
||
|
UPROPERTY(config, EditAnywhere)
|
||
|
TMap<TEnumAsByte<EPhysicalSurface>, FGameplayTag> SurfaceTypeToContextMap;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
UCLASS()
|
||
|
class LYRAGAME_API ULyraContextEffectsSet : public UObject
|
||
|
{
|
||
|
GENERATED_BODY()
|
||
|
|
||
|
public:
|
||
|
UPROPERTY(Transient)
|
||
|
TSet<ULyraContextEffectsLibrary*> LyraContextEffectsLibraries;
|
||
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
UCLASS()
|
||
|
class LYRAGAME_API ULyraContextEffectsSubsystem : public UWorldSubsystem
|
||
|
{
|
||
|
GENERATED_BODY()
|
||
|
|
||
|
public:
|
||
|
/** */
|
||
|
UFUNCTION(BlueprintCallable, Category = "ContextEffects")
|
||
|
void SpawnContextEffects(
|
||
|
const AActor* SpawningActor
|
||
|
, USceneComponent* AttachToComponent
|
||
|
, const FName AttachPoint
|
||
|
, const FVector LocationOffset
|
||
|
, const FRotator RotationOffset
|
||
|
, FGameplayTag Effect
|
||
|
, FGameplayTagContainer Contexts
|
||
|
, TArray<UAudioComponent*>& AudioOut
|
||
|
, TArray<UNiagaraComponent*>& NiagaraOut
|
||
|
, FVector VFXScale = FVector(1)
|
||
|
, float AudioVolume = 1
|
||
|
, float AudioPitch = 1);
|
||
|
|
||
|
/** */
|
||
|
UFUNCTION(BlueprintCallable, Category = "ContextEffects")
|
||
|
bool GetContextFromSurfaceType(TEnumAsByte<EPhysicalSurface> PhysicalSurface, FGameplayTag& Context);
|
||
|
|
||
|
/** */
|
||
|
UFUNCTION(BlueprintCallable, Category = "ContextEffects")
|
||
|
void LoadAndAddContextEffectsLibraries(AActor* OwningActor, TSet<TSoftObjectPtr<ULyraContextEffectsLibrary>> ContextEffectsLibraries);
|
||
|
|
||
|
/** */
|
||
|
UFUNCTION(BlueprintCallable, Category = "ContextEffects")
|
||
|
void UnloadAndRemoveContextEffectsLibraries(AActor* OwningActor);
|
||
|
|
||
|
private:
|
||
|
|
||
|
UPROPERTY(Transient)
|
||
|
TMap<AActor*, ULyraContextEffectsSet*> ActiveActorEffectsMap;
|
||
|
|
||
|
};
|