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 "Chaos/ChaosEngineInterface.h"
|
|
|
|
#include "Containers/Array.h"
|
|
|
|
#include "Containers/EnumAsByte.h"
|
|
|
|
#include "Containers/Map.h"
|
|
|
|
#include "Containers/Set.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "Engine/DeveloperSettings.h"
|
|
|
|
#include "GameplayTagContainer.h"
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Math/MathFwd.h"
|
|
|
|
#include "Math/Rotator.h"
|
|
|
|
#include "Math/Vector.h"
|
|
|
|
#include "Subsystems/WorldSubsystem.h"
|
|
|
|
#include "UObject/NameTypes.h"
|
|
|
|
#include "UObject/Object.h"
|
|
|
|
#include "UObject/SoftObjectPtr.h"
|
|
|
|
#include "UObject/UObjectGlobals.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
#include "LyraContextEffectsSubsystem.generated.h"
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
class AActor;
|
|
|
|
class UAudioComponent;
|
2022-05-23 18:41:30 +00:00
|
|
|
class ULyraContextEffectsLibrary;
|
|
|
|
class UNiagaraComponent;
|
2022-09-13 07:18:28 +00:00
|
|
|
class USceneComponent;
|
|
|
|
struct FFrame;
|
|
|
|
struct FGameplayTag;
|
|
|
|
struct FGameplayTagContainer;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
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)
|
2022-09-13 07:18:28 +00:00
|
|
|
TSet<TObjectPtr<ULyraContextEffectsLibrary>> LyraContextEffectsLibraries;
|
2022-05-23 18:41:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
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)
|
2022-09-13 07:18:28 +00:00
|
|
|
TMap<TObjectPtr<AActor>, TObjectPtr<ULyraContextEffectsSet>> ActiveActorEffectsMap;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
};
|