SurfaceTypeToContextMap
SurfaceTypeToContextMap
#Overview
name: SurfaceTypeToContextMap
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of SurfaceTypeToContextMap is to provide a mapping between physical surface types and gameplay tags in the Lyra game project’s context effects system. This variable is used to convert physical surface information into meaningful gameplay contexts, which can then be used to trigger appropriate visual or audio effects based on the surface a character is interacting with.
This setting variable is primarily used by the Lyra game project’s context effects system, which is part of the feedback module. The main components and classes that rely on this variable are:
- ULyraContextEffectsSettings
- ULyraContextEffectComponent
- ULyraContextEffectsSubsystem
- AnimNotify_LyraContextEffects
The value of this variable is set in the ULyraContextEffectsSettings class, which inherits from UDeveloperSettings. This suggests that the mapping can be configured through the project settings in the Unreal Engine editor.
SurfaceTypeToContextMap interacts with the EPhysicalSurface enum and FGameplayTag struct. It uses EPhysicalSurface as the key and FGameplayTag as the value in the TMap.
Developers should be aware that this variable is crucial for translating physical surface types into gameplay contexts. Proper configuration of this mapping is essential for the context effects system to work correctly.
Best practices when using this variable include:
- Ensuring all relevant physical surface types are mapped to appropriate gameplay tags.
- Maintaining consistency in the mapping across the project.
- Documenting the meaning and intended use of each gameplay tag used in the mapping.
- Regularly reviewing and updating the mapping as new surface types or gameplay contexts are added to the project.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:208, section: [/Script/LyraGame.LyraContextEffectsSettings]
- INI Section:
/Script/LyraGame.LyraContextEffectsSettings
- Raw value:
((SurfaceType3, (TagName="SurfaceType.Glass")),(SurfaceType2, (TagName="SurfaceType.Concrete")),(SurfaceType1, (TagName="SurfaceType.Character")),(SurfaceType_Default, (TagName="SurfaceType.Default")))
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Feedback/ContextEffects/AnimNotify_LyraContextEffects.cpp:137
Scope: file
Source code excerpt:
if (const ULyraContextEffectsSettings* LyraContextEffectsSettings = GetDefault<ULyraContextEffectsSettings>())
{
if (const FGameplayTag* SurfaceContextPtr = LyraContextEffectsSettings->SurfaceTypeToContextMap.Find(PhysicalSurfaceType))
{
FGameplayTag SurfaceContext = *SurfaceContextPtr;
Contexts.AddTag(SurfaceContext);
}
}
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Feedback/ContextEffects/LyraContextEffectComponent.cpp:89
Scope (from outer to inner):
file
function void ULyraContextEffectComponent::AnimMotionEffect_Implementation
Source code excerpt:
{
// Convert Surface Type to known
if (const FGameplayTag* SurfaceContextPtr = LyraContextEffectsSettings->SurfaceTypeToContextMap.Find(PhysicalSurfaceType))
{
FGameplayTag SurfaceContext = *SurfaceContextPtr;
TotalContexts.AddTag(SurfaceContext);
}
}
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Feedback/ContextEffects/LyraContextEffectsSubsystem.cpp:95
Scope (from outer to inner):
file
function bool ULyraContextEffectsSubsystem::GetContextFromSurfaceType
Source code excerpt:
{
// Find which Gameplay Tag the Surface Type is mapped to
if (const FGameplayTag* GameplayTagPtr = ProjectSettings->SurfaceTypeToContextMap.Find(PhysicalSurface))
{
Context = *GameplayTagPtr;
}
}
// Return true if Context is Valid
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Feedback/ContextEffects/LyraContextEffectsSubsystem.h:30
Scope (from outer to inner):
file
class class ULyraContextEffectsSettings : public UDeveloperSettings
Source code excerpt:
//
UPROPERTY(config, EditAnywhere)
TMap<TEnumAsByte<EPhysicalSurface>, FGameplayTag> SurfaceTypeToContextMap;
};
/**
*
*/
UCLASS()