Alexhas2 commited on
Commit
d65b63c
·
verified ·
1 Parent(s): 26e1abf

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/AccoladeDataRegistry.uasset +0 -0
  2. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/B_AccoladeRelay.uasset +0 -0
  3. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/B_ElimChainProcessor.uasset +0 -0
  4. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/B_ElimStreakProcessor.uasset +0 -0
  5. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/B_EliminationFeedRelay.uasset +0 -0
  6. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/DT_BasicShooterAccolades.uasset +0 -0
  7. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/EAS_BasicShooterAcolades.uasset +0 -0
  8. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Blueprint/B_AbilitySpawner.uasset +0 -0
  9. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Blueprint/B_AimAssistTargetTest.uasset +0 -0
  10. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/ShooterCore.uasset +0 -0
  11. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Accolades/LyraAccoladeDefinition.cpp +6 -0
  12. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Accolades/LyraAccoladeHostWidget.cpp +166 -0
  13. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Input/AimAssistInputModifier.cpp +886 -0
  14. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Input/AimAssistTargetComponent.cpp +20 -0
  15. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Input/AimAssistTargetManagerComponent.cpp +489 -0
  16. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/LyraWorldCollectable.cpp +23 -0
  17. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/MessageProcessors/AssistProcessor.cpp +74 -0
  18. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/MessageProcessors/ElimChainProcessor.cpp +59 -0
  19. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/MessageProcessors/ElimStreakProcessor.cpp +53 -0
  20. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/ShooterCoreRuntimeModule.cpp +19 -0
  21. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/ShooterCoreRuntimeSettings.cpp +11 -0
  22. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/TDM_PlayerSpawningManagmentComponent.cpp +94 -0
  23. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/TDM_PlayerSpawningManagmentComponent.h +31 -0
  24. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Accolades/LyraAccoladeDefinition.h +75 -0
  25. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Accolades/LyraAccoladeHostWidget.h +89 -0
  26. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Input/AimAssistInputModifier.h +407 -0
  27. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Input/AimAssistTargetComponent.h +35 -0
  28. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Input/AimAssistTargetManagerComponent.h +58 -0
  29. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Input/IAimAssistTargetInterface.h +57 -0
  30. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/LyraWorldCollectable.h +36 -0
  31. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/MessageProcessors/AssistProcessor.h +43 -0
  32. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/MessageProcessors/ElimChainProcessor.h +48 -0
  33. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/MessageProcessors/ElimStreakProcessor.h +35 -0
  34. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Messages/ControlPointStatusMessage.h +20 -0
  35. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/ShooterCoreRuntimeModule.h +20 -0
  36. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/ShooterCoreRuntimeSettings.h +31 -0
  37. LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/ShooterCoreRuntime.Build.cs +68 -0
  38. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Config/Tags/ShooterExplorerTags.ini +45 -0
  39. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Evaluators/EV_PlayerPosition.uasset +0 -0
  40. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_Follow.uasset +0 -0
  41. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_GetPlayerLocation.uasset +0 -0
  42. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_GoTo.uasset +0 -0
  43. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_PlayAnimMontage1.uasset +0 -0
  44. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_SimpleDebugDelays.uasset +0 -0
  45. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Blueprint/B_SimpleFollowPawn.uasset +0 -0
  46. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Blueprint/B_SimpleFollowPawn_Big.uasset +0 -0
  47. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Game/HeroData_Explorer.uasset +0 -0
  48. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Input/Abilities/AbilitySet_InventoryTest.uasset +0 -0
  49. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Input/Abilities/GA_Interact.uasset +0 -0
  50. LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Input/Abilities/GA_ToggleInventory.uasset +0 -0
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/AccoladeDataRegistry.uasset ADDED
Binary file (2.79 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/B_AccoladeRelay.uasset ADDED
Binary file (68.9 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/B_ElimChainProcessor.uasset ADDED
Binary file (7.05 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/B_ElimStreakProcessor.uasset ADDED
Binary file (7.18 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/B_EliminationFeedRelay.uasset ADDED
Binary file (97.2 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/DT_BasicShooterAccolades.uasset ADDED
Binary file (8.64 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Accolades/EAS_BasicShooterAcolades.uasset ADDED
Binary file (4.24 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Blueprint/B_AbilitySpawner.uasset ADDED
Binary file (99.1 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/Blueprint/B_AimAssistTargetTest.uasset ADDED
Binary file (30.1 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Content/ShooterCore.uasset ADDED
Binary file (13.4 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Accolades/LyraAccoladeDefinition.cpp ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "Accolades/LyraAccoladeDefinition.h"
4
+
5
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(LyraAccoladeDefinition)
6
+
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Accolades/LyraAccoladeHostWidget.cpp ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "Accolades/LyraAccoladeHostWidget.h"
4
+
5
+ #include "DataRegistrySubsystem.h"
6
+ #include "LyraLogChannels.h"
7
+ #include "Messages/LyraNotificationMessage.h"
8
+ #include "Sound/SoundBase.h"
9
+ #include "TimerManager.h"
10
+
11
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(LyraAccoladeHostWidget)
12
+
13
+ class UUserWidget;
14
+
15
+ UE_DEFINE_GAMEPLAY_TAG_STATIC(TAG_Lyra_ShooterGame_Accolade, "Lyra.ShooterGame.Accolade");
16
+
17
+ static FName NAME_AccoladeRegistryID("Accolades");
18
+
19
+ void ULyraAccoladeHostWidget::NativeConstruct()
20
+ {
21
+ Super::NativeConstruct();
22
+
23
+ UGameplayMessageSubsystem& MessageSubsystem = UGameplayMessageSubsystem::Get(this);
24
+ ListenerHandle = MessageSubsystem.RegisterListener(TAG_Lyra_AddNotification_Message, this, &ThisClass::OnNotificationMessage);
25
+ }
26
+
27
+ void ULyraAccoladeHostWidget::NativeDestruct()
28
+ {
29
+ UGameplayMessageSubsystem& MessageSubsystem = UGameplayMessageSubsystem::Get(this);
30
+ MessageSubsystem.UnregisterListener(ListenerHandle);
31
+
32
+ CancelAsyncLoading();
33
+
34
+ Super::NativeDestruct();
35
+ }
36
+
37
+ void ULyraAccoladeHostWidget::OnNotificationMessage(FGameplayTag Channel, const FLyraNotificationMessage& Notification)
38
+ {
39
+ if (Notification.TargetChannel == TAG_Lyra_ShooterGame_Accolade)
40
+ {
41
+ // Ignore notifications for other players
42
+ if (Notification.TargetPlayer != nullptr)
43
+ {
44
+ APlayerController* PC = GetOwningPlayer();
45
+ if ((PC == nullptr) || (PC->PlayerState != Notification.TargetPlayer))
46
+ {
47
+ return;
48
+ }
49
+ }
50
+
51
+ // Load the data registry row for this accolade
52
+ const int32 NextID = AllocatedSequenceID;
53
+ ++AllocatedSequenceID;
54
+
55
+ FDataRegistryId ItemID(NAME_AccoladeRegistryID, Notification.PayloadTag.GetTagName());
56
+ if (!UDataRegistrySubsystem::Get()->AcquireItem(ItemID, FDataRegistryItemAcquiredCallback::CreateUObject(this, &ThisClass::OnRegistryLoadCompleted, NextID)))
57
+ {
58
+ UE_LOG(LogLyra, Error, TEXT("Failed to find accolade registry for tag %s, accolades will not appear"), *Notification.PayloadTag.GetTagName().ToString());
59
+ --AllocatedSequenceID;
60
+ }
61
+ }
62
+ }
63
+
64
+ void ULyraAccoladeHostWidget::OnRegistryLoadCompleted(const FDataRegistryAcquireResult& AccoladeHandle, int32 SequenceID)
65
+ {
66
+ if (const FLyraAccoladeDefinitionRow* AccoladeRow = AccoladeHandle.GetItem<FLyraAccoladeDefinitionRow>())
67
+ {
68
+ FPendingAccoladeEntry& PendingEntry = PendingAccoladeLoads.AddDefaulted_GetRef();
69
+ PendingEntry.Row = *AccoladeRow;
70
+ PendingEntry.SequenceID = SequenceID;
71
+
72
+ TArray<FSoftObjectPath> AssetsToLoad;
73
+ AssetsToLoad.Add(AccoladeRow->Sound.ToSoftObjectPath());
74
+ AssetsToLoad.Add(AccoladeRow->Icon.ToSoftObjectPath());
75
+ AsyncLoad(AssetsToLoad, [this, SequenceID]
76
+ {
77
+ FPendingAccoladeEntry* EntryThatFinishedLoading = PendingAccoladeLoads.FindByPredicate([SequenceID](const FPendingAccoladeEntry& Entry) { return Entry.SequenceID == SequenceID; });
78
+ if (ensure(EntryThatFinishedLoading))
79
+ {
80
+ EntryThatFinishedLoading->Sound = EntryThatFinishedLoading->Row.Sound.Get();
81
+ EntryThatFinishedLoading->Icon = EntryThatFinishedLoading->Row.Icon.Get();
82
+ EntryThatFinishedLoading->bFinishedLoading = true;
83
+ ConsiderLoadedAccolades();
84
+ }
85
+ });
86
+ StartAsyncLoading();
87
+ }
88
+ else
89
+ {
90
+ ensure(false);
91
+ }
92
+ }
93
+
94
+ void ULyraAccoladeHostWidget::ConsiderLoadedAccolades()
95
+ {
96
+ int32 PendingIndexToDisplay;
97
+ do
98
+ {
99
+ PendingIndexToDisplay = PendingAccoladeLoads.IndexOfByPredicate([DesiredID=NextDisplaySequenceID](const FPendingAccoladeEntry& Entry) { return Entry.bFinishedLoading && Entry.SequenceID == DesiredID; });
100
+ if (PendingIndexToDisplay != INDEX_NONE)
101
+ {
102
+ FPendingAccoladeEntry Entry = MoveTemp(PendingAccoladeLoads[PendingIndexToDisplay]);
103
+ PendingAccoladeLoads.RemoveAtSwap(PendingIndexToDisplay);
104
+
105
+ ProcessLoadedAccolade(Entry);
106
+ ++NextDisplaySequenceID;
107
+ }
108
+ } while (PendingIndexToDisplay != INDEX_NONE);
109
+ }
110
+
111
+ void ULyraAccoladeHostWidget::ProcessLoadedAccolade(const FPendingAccoladeEntry& Entry)
112
+ {
113
+ if (Entry.Row.LocationTag == LocationName)
114
+ {
115
+ bool bRecreateWidget = PendingAccoladeDisplays.Num() == 0;
116
+ for (int32 Index = 0; Index < PendingAccoladeDisplays.Num(); )
117
+ {
118
+ if (PendingAccoladeDisplays[Index].Row.AccoladeTags.HasAny(Entry.Row.CancelAccoladesWithTag))
119
+ {
120
+ if (UUserWidget* OldWidget = PendingAccoladeDisplays[Index].AllocatedWidget)
121
+ {
122
+ DestroyAccoladeWidget(OldWidget);
123
+ bRecreateWidget = true;
124
+ }
125
+ PendingAccoladeDisplays.RemoveAt(Index);
126
+ }
127
+ else
128
+ {
129
+ ++Index;
130
+ }
131
+ }
132
+
133
+ PendingAccoladeDisplays.Add(Entry);
134
+
135
+ if (bRecreateWidget)
136
+ {
137
+ DisplayNextAccolade();
138
+ }
139
+ }
140
+ }
141
+
142
+ void ULyraAccoladeHostWidget::DisplayNextAccolade()
143
+ {
144
+ if (PendingAccoladeDisplays.Num() > 0)
145
+ {
146
+ FPendingAccoladeEntry& Entry = PendingAccoladeDisplays[0];
147
+
148
+ GetWorld()->GetTimerManager().SetTimer(NextTimeToReconsiderHandle, this, &ThisClass::PopDisplayedAccolade, Entry.Row.DisplayDuration);
149
+ Entry.AllocatedWidget = CreateAccoladeWidget(Entry);
150
+ }
151
+ }
152
+
153
+ void ULyraAccoladeHostWidget::PopDisplayedAccolade()
154
+ {
155
+ if (PendingAccoladeDisplays.Num() > 0)
156
+ {
157
+ if (UUserWidget* OldWidget = PendingAccoladeDisplays[0].AllocatedWidget)
158
+ {
159
+ DestroyAccoladeWidget(OldWidget);
160
+ }
161
+ PendingAccoladeDisplays.RemoveAt(0);
162
+ }
163
+
164
+ DisplayNextAccolade();
165
+ }
166
+
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Input/AimAssistInputModifier.cpp ADDED
@@ -0,0 +1,886 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "Input/AimAssistInputModifier.h"
4
+ #include "CommonInputTypeEnum.h"
5
+ #include "Curves/CurveFloat.h"
6
+ #include "Engine/Engine.h"
7
+ #include "Engine/GameViewportClient.h"
8
+ #include "Engine/World.h"
9
+ #include "EnhancedPlayerInput.h"
10
+ #include "Input/AimAssistTargetManagerComponent.h"
11
+ #include "Input/LyraAimSensitivityData.h"
12
+ #include "Player/LyraLocalPlayer.h"
13
+ #include "Player/LyraPlayerState.h"
14
+ #include "SceneView.h"
15
+ #include "Settings/LyraSettingsShared.h"
16
+
17
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(AimAssistInputModifier)
18
+
19
+ #if ENABLE_DRAW_DEBUG
20
+ #include "Engine/Canvas.h"
21
+ #include "Debug/DebugDrawService.h"
22
+ #endif // ENABLE_DRAW_DEBUG
23
+
24
+ DEFINE_LOG_CATEGORY(LogAimAssist);
25
+
26
+ namespace LyraConsoleVariables
27
+ {
28
+ static bool bEnableAimAssist = true;
29
+ static FAutoConsoleVariableRef CVarEnableAimAssist(
30
+ TEXT("lyra.Weapon.EnableAimAssist"),
31
+ bEnableAimAssist,
32
+ TEXT("Should we enable aim assist while shooting?"),
33
+ ECVF_Cheat);
34
+
35
+ static bool bDrawAimAssistDebug = false;
36
+ static FAutoConsoleVariableRef CVarDrawAimAssistDebug(
37
+ TEXT("lyra.Weapon.DrawAimAssistDebug"),
38
+ bDrawAimAssistDebug,
39
+ TEXT("Should we draw some debug stats about aim assist?"),
40
+ ECVF_Cheat);
41
+ }
42
+
43
+ ///////////////////////////////////////////////////////////////////
44
+ // FLyraAimAssistTarget
45
+
46
+ void FLyraAimAssistTarget::ResetTarget()
47
+ {
48
+ TargetShapeComponent = nullptr;
49
+
50
+ Location = FVector::ZeroVector;
51
+ DeltaMovement = FVector::ZeroVector;
52
+ ScreenBounds.Init();
53
+
54
+ ViewDistance = 0.0f;
55
+ SortScore = 0.0f;
56
+
57
+ AssistTime = 0.0f;
58
+ AssistWeight = 0.0f;
59
+
60
+ VisibilityTraceHandle = FTraceHandle();
61
+
62
+ bIsVisible = false;
63
+ bUnderAssistInnerReticle = false;
64
+ bUnderAssistOuterReticle = false;
65
+ }
66
+
67
+ FRotator FLyraAimAssistTarget::GetRotationFromMovement(const FAimAssistOwnerViewData& OwnerInfo) const
68
+ {
69
+ ensure(OwnerInfo.IsDataValid());
70
+
71
+ // Convert everything into player space.
72
+ // Account for player movement in new target location.
73
+ const FVector OldLocation = OwnerInfo.PlayerInverseTransform.TransformPositionNoScale(Location - DeltaMovement);
74
+ const FVector NewLocation = OwnerInfo.PlayerInverseTransform.TransformPositionNoScale(Location - OwnerInfo.DeltaMovement);
75
+
76
+ FRotator RotationToTarget;
77
+ RotationToTarget.Yaw = CalculateRotationToTarget2D(NewLocation.X, NewLocation.Y, OldLocation.Y);
78
+ RotationToTarget.Pitch = CalculateRotationToTarget2D(NewLocation.X, NewLocation.Z, OldLocation.Z);
79
+ RotationToTarget.Roll = 0.0f;
80
+
81
+ return RotationToTarget;
82
+ }
83
+
84
+ float FLyraAimAssistTarget::CalculateRotationToTarget2D(float TargetX, float TargetY, float OffsetY) const
85
+ {
86
+ if (TargetX <= 0.0f)
87
+ {
88
+ return 0.0f;
89
+ }
90
+
91
+ const float AngleA = FMath::RadiansToDegrees(FMath::Atan2(TargetY, TargetX));
92
+
93
+ if (FMath::IsNearlyZero(OffsetY))
94
+ {
95
+ return AngleA;
96
+ }
97
+
98
+ const float Distance = FMath::Sqrt((TargetX * TargetX) + (TargetY * TargetY));
99
+ ensure(Distance > 0.0f);
100
+
101
+ const float AngleB = FMath::RadiansToDegrees(FMath::Asin(OffsetY / Distance));
102
+
103
+ return FRotator::NormalizeAxis(AngleA - AngleB);
104
+ }
105
+
106
+ ///////////////////////////////////////////////////////////////////
107
+ // FAimAssistSettings
108
+
109
+ FAimAssistSettings::FAimAssistSettings()
110
+ {
111
+ AssistInnerReticleWidth.SetValue(20.0f);
112
+ AssistInnerReticleHeight.SetValue(20.0f);
113
+ AssistOuterReticleWidth.SetValue(80.0f);
114
+ AssistOuterReticleHeight.SetValue(80.0f);
115
+
116
+ TargetingReticleWidth.SetValue(1200.0f);
117
+ TargetingReticleHeight.SetValue(675.0f);
118
+ TargetRange.SetValue(10000.0f);
119
+ TargetWeightCurve = nullptr;
120
+
121
+ PullInnerStrengthHip.SetValue(0.6f);
122
+ PullOuterStrengthHip.SetValue(0.5f);
123
+ PullInnerStrengthAds.SetValue(0.7f);
124
+ PullOuterStrengthAds.SetValue(0.4f);
125
+ PullLerpInRate.SetValue(60.0f);
126
+ PullLerpOutRate.SetValue(4.0f);
127
+ PullMaxRotationRate.SetValue(0.0f);
128
+
129
+ SlowInnerStrengthHip.SetValue(0.6f);
130
+ SlowOuterStrengthHip.SetValue(0.5f);
131
+ SlowInnerStrengthAds.SetValue(0.7f);
132
+ SlowOuterStrengthAds.SetValue(0.4f);
133
+ SlowLerpInRate.SetValue(60.0f);
134
+ SlowLerpOutRate.SetValue(4.0f);
135
+ SlowMinRotationRate.SetValue(0.0f);
136
+
137
+ bEnableAsyncVisibilityTrace = true;
138
+ bRequireInput = true;
139
+ bApplyPull = true;
140
+ bApplySlowing = true;
141
+ bApplyStrafePullScale = true;
142
+ bUseDynamicSlow = true;
143
+ bUseRadialLookRates = true;
144
+ }
145
+
146
+ float FAimAssistSettings::GetTargetWeightForTime(float Time) const
147
+ {
148
+ if (!ensure(TargetWeightCurve != nullptr))
149
+ {
150
+ return 0.0f;
151
+ }
152
+
153
+ return FMath::Clamp(TargetWeightCurve->GetFloatValue(Time), 0.0f, 1.0f);
154
+ }
155
+
156
+ float FAimAssistSettings::GetTargetWeightMaxTime() const
157
+ {
158
+ if (!ensure(TargetWeightCurve != nullptr))
159
+ {
160
+ return 0.0f;
161
+ }
162
+
163
+ float MinTime = 0.0f;
164
+ float MaxTime = 0.0f;
165
+
166
+ TargetWeightCurve->FloatCurve.GetTimeRange(MinTime, MaxTime);
167
+
168
+ return MaxTime;
169
+ }
170
+
171
+ ///////////////////////////////////////////////////////////////////
172
+ // FAimAssistOwnerViewData
173
+
174
+ void FAimAssistOwnerViewData::UpdateViewData(const APlayerController* PC)
175
+ {
176
+ FSceneViewProjectionData ProjectionData;
177
+ PlayerController = PC;
178
+ LocalPlayer = PlayerController ? PlayerController->GetLocalPlayer() : nullptr;
179
+
180
+ if (!IsDataValid() || !PlayerController || !LocalPlayer)
181
+ {
182
+ ResetViewData();
183
+ return;
184
+ }
185
+
186
+ const APawn* Pawn = Cast<APawn>(PlayerController->GetPawn());
187
+
188
+ if (!Pawn || !LocalPlayer || !LocalPlayer->ViewportClient || !LocalPlayer->GetProjectionData(LocalPlayer->ViewportClient->Viewport, ProjectionData))
189
+ {
190
+ ResetViewData();
191
+ return;
192
+ }
193
+
194
+ FVector ViewLocation;
195
+ FRotator ViewRotation;
196
+ PC->GetPlayerViewPoint(ViewLocation, ViewRotation);
197
+
198
+ ProjectionMatrix = ProjectionData.ProjectionMatrix;
199
+ ViewProjectionMatrix = ProjectionData.ComputeViewProjectionMatrix();
200
+ ViewRect = ProjectionData.GetConstrainedViewRect();
201
+ ViewTransform = FTransform(ViewRotation, ViewLocation);
202
+ ViewForward = ViewTransform.GetUnitAxis(EAxis::X);
203
+
204
+ const FVector OldLocation = PlayerTransform.GetTranslation();
205
+ const FVector NewLocation = Pawn->GetActorLocation();
206
+ const FRotator NewRotation = PC->GetControlRotation();
207
+
208
+ PlayerTransform = FTransform(NewRotation, NewLocation);
209
+ PlayerInverseTransform = PlayerTransform.Inverse();
210
+
211
+ DeltaMovement = (NewLocation - OldLocation);
212
+
213
+ // Set the Team ID
214
+ if (ALyraPlayerState* LyraPS = PlayerController->GetPlayerState<ALyraPlayerState>())
215
+ {
216
+ TeamID = LyraPS->GetTeamId();
217
+ }
218
+ else
219
+ {
220
+ TeamID = INDEX_NONE;
221
+ }
222
+ }
223
+
224
+ void FAimAssistOwnerViewData::ResetViewData()
225
+ {
226
+ PlayerController = nullptr;
227
+ LocalPlayer = nullptr;
228
+
229
+ ProjectionMatrix = FMatrix::Identity;
230
+ ViewProjectionMatrix = FMatrix::Identity;
231
+ ViewRect = FIntRect(0, 0, 0, 0);
232
+ ViewTransform = FTransform::Identity;
233
+
234
+ PlayerTransform = FTransform::Identity;
235
+ PlayerInverseTransform = FTransform::Identity;
236
+ ViewForward = FVector::ZeroVector;
237
+
238
+ DeltaMovement = FVector::ZeroVector;
239
+ TeamID = INDEX_NONE;
240
+ }
241
+
242
+ FBox2D FAimAssistOwnerViewData::ProjectReticleToScreen(float ReticleWidth, float ReticleHeight, float ReticleDepth) const
243
+ {
244
+ FBox2D ReticleBounds(ForceInitToZero);
245
+
246
+ const FVector ReticleExtents((ReticleWidth * 0.5f), -(ReticleHeight * 0.5f), ReticleDepth);
247
+
248
+ if (FSceneView::ProjectWorldToScreen(ReticleExtents, ViewRect, ProjectionMatrix, ReticleBounds.Max))
249
+ {
250
+ ReticleBounds.Min.X = ViewRect.Min.X + (ViewRect.Max.X - ReticleBounds.Max.X);
251
+ ReticleBounds.Min.Y = ViewRect.Min.Y + (ViewRect.Max.Y - ReticleBounds.Max.Y);
252
+
253
+ ReticleBounds.bIsValid = true;
254
+ }
255
+
256
+ return ReticleBounds;
257
+ }
258
+
259
+ FBox2D FAimAssistOwnerViewData::ProjectBoundsToScreen(const FBox& Bounds) const
260
+ {
261
+ FBox2D Box2D(ForceInitToZero);
262
+
263
+ if (Bounds.IsValid)
264
+ {
265
+ const FVector Vertices[] =
266
+ {
267
+ FVector(Bounds.Min),
268
+ FVector(Bounds.Min.X, Bounds.Min.Y, Bounds.Max.Z),
269
+ FVector(Bounds.Min.X, Bounds.Max.Y, Bounds.Min.Z),
270
+ FVector(Bounds.Max.X, Bounds.Min.Y, Bounds.Min.Z),
271
+ FVector(Bounds.Max.X, Bounds.Max.Y, Bounds.Min.Z),
272
+ FVector(Bounds.Max.X, Bounds.Min.Y, Bounds.Max.Z),
273
+ FVector(Bounds.Min.X, Bounds.Max.Y, Bounds.Max.Z),
274
+ FVector(Bounds.Max)
275
+ };
276
+
277
+ for (int32 VerticeIndex = 0; VerticeIndex < UE_ARRAY_COUNT(Vertices); ++VerticeIndex)
278
+ {
279
+ FVector2D ScreenPoint;
280
+ if (FSceneView::ProjectWorldToScreen(Vertices[VerticeIndex], ViewRect, ViewProjectionMatrix, ScreenPoint))
281
+ {
282
+ Box2D += ScreenPoint;
283
+ }
284
+ }
285
+ }
286
+
287
+ return Box2D;
288
+ }
289
+
290
+ FBox2D FAimAssistOwnerViewData::ProjectShapeToScreen(const FCollisionShape& Shape, const FVector& ShapeOrigin, const FTransform& WorldTransform) const
291
+ {
292
+ FBox2D Box2D(ForceInitToZero);
293
+
294
+ switch (Shape.ShapeType)
295
+ {
296
+ case ECollisionShape::Box:
297
+ Box2D = ProjectBoxToScreen(Shape, ShapeOrigin, WorldTransform);
298
+ break;
299
+ case ECollisionShape::Sphere:
300
+ Box2D = ProjectSphereToScreen(Shape, ShapeOrigin, WorldTransform);
301
+ break;
302
+ case ECollisionShape::Capsule:
303
+ Box2D = ProjectCapsuleToScreen(Shape, ShapeOrigin, WorldTransform);
304
+ break;
305
+ default:
306
+ UE_LOG(LogAimAssist, Warning, TEXT("FAimAssistOwnerViewData::ProjectShapeToScreen() - Invalid shape type!"));
307
+ break;
308
+ }
309
+
310
+ return Box2D;
311
+ }
312
+
313
+ FBox2D FAimAssistOwnerViewData::ProjectBoxToScreen(const FCollisionShape& Shape, const FVector& ShapeOrigin, const FTransform& WorldTransform) const
314
+ {
315
+ check(Shape.IsBox());
316
+ check(!Shape.IsNearlyZero());
317
+
318
+ const FVector BoxExtents = Shape.GetBox();
319
+
320
+ const FVector Vertices[] =
321
+ {
322
+ FVector(-BoxExtents.X, -BoxExtents.Y, -BoxExtents.Z),
323
+ FVector(-BoxExtents.X, -BoxExtents.Y, BoxExtents.Z),
324
+ FVector(-BoxExtents.X, BoxExtents.Y, -BoxExtents.Z),
325
+ FVector(-BoxExtents.X, BoxExtents.Y, BoxExtents.Z),
326
+ FVector( BoxExtents.X, -BoxExtents.Y, -BoxExtents.Z),
327
+ FVector( BoxExtents.X, -BoxExtents.Y, BoxExtents.Z),
328
+ FVector( BoxExtents.X, BoxExtents.Y, -BoxExtents.Z),
329
+ FVector( BoxExtents.X, BoxExtents.Y, BoxExtents.Z)
330
+ };
331
+
332
+ FBox2D Box2D(ForceInitToZero);
333
+
334
+ for (int32 VerticeIndex = 0; VerticeIndex < UE_ARRAY_COUNT(Vertices); ++VerticeIndex)
335
+ {
336
+ const FVector Vertex = WorldTransform.TransformPositionNoScale(Vertices[VerticeIndex] + ShapeOrigin);
337
+
338
+ FVector2D ScreenPoint;
339
+ if (FSceneView::ProjectWorldToScreen(Vertex, ViewRect, ViewProjectionMatrix, ScreenPoint))
340
+ {
341
+ Box2D += ScreenPoint;
342
+ }
343
+ }
344
+
345
+ return Box2D;
346
+ }
347
+
348
+ FBox2D FAimAssistOwnerViewData::ProjectSphereToScreen(const FCollisionShape& Shape, const FVector& ShapeOrigin, const FTransform& WorldTransform) const
349
+ {
350
+ check(Shape.IsSphere());
351
+ check(!Shape.IsNearlyZero());
352
+
353
+ const FVector ViewAxisY = ViewTransform.GetUnitAxis(EAxis::Y);
354
+ const FVector ViewAxisZ = ViewTransform.GetUnitAxis(EAxis::Z);
355
+
356
+ const float SphereRadius = Shape.GetSphereRadius();
357
+ const FVector SphereLocation = WorldTransform.TransformPositionNoScale(ShapeOrigin);
358
+ const FVector SphereExtent = (ViewAxisY * SphereRadius) + (ViewAxisZ * SphereRadius);
359
+
360
+ const FVector Vertices[] =
361
+ {
362
+ FVector(SphereLocation + SphereExtent),
363
+ FVector(SphereLocation - SphereExtent),
364
+ };
365
+
366
+ FBox2D Box2D(ForceInitToZero);
367
+
368
+ for (int32 VerticeIndex = 0; VerticeIndex < UE_ARRAY_COUNT(Vertices); ++VerticeIndex)
369
+ {
370
+ FVector2D ScreenPoint;
371
+ if (FSceneView::ProjectWorldToScreen(Vertices[VerticeIndex], ViewRect, ViewProjectionMatrix, ScreenPoint))
372
+ {
373
+ Box2D += ScreenPoint;
374
+ }
375
+ }
376
+
377
+ return Box2D;
378
+ }
379
+
380
+ FBox2D FAimAssistOwnerViewData::ProjectCapsuleToScreen(const FCollisionShape& Shape, const FVector& ShapeOrigin, const FTransform& WorldTransform) const
381
+ {
382
+ check(Shape.IsCapsule());
383
+ check(!Shape.IsNearlyZero());
384
+
385
+ const FVector ViewAxisY = ViewTransform.GetUnitAxis(EAxis::Y);
386
+ const FVector ViewAxisZ = ViewTransform.GetUnitAxis(EAxis::Z);
387
+
388
+ const float CapsuleAxisHalfLength = Shape.GetCapsuleAxisHalfLength();
389
+ const float CapsuleRadius = Shape.GetCapsuleRadius();
390
+
391
+ const FVector TopSphereLocation = WorldTransform.TransformPositionNoScale(FVector(0.0f, 0.0f, CapsuleAxisHalfLength) + ShapeOrigin);
392
+ const FVector BottomSphereLocation = WorldTransform.TransformPositionNoScale(FVector(0.0f, 0.0f, -CapsuleAxisHalfLength) + ShapeOrigin);
393
+ const FVector SphereExtent = (ViewAxisY * CapsuleRadius) + (ViewAxisZ * CapsuleRadius);
394
+
395
+ const FVector Vertices[] =
396
+ {
397
+ FVector(TopSphereLocation + SphereExtent),
398
+ FVector(TopSphereLocation - SphereExtent),
399
+ FVector(BottomSphereLocation + SphereExtent),
400
+ FVector(BottomSphereLocation - SphereExtent),
401
+ };
402
+
403
+ FBox2D Box2D(ForceInitToZero);
404
+
405
+ for (int32 VerticeIndex = 0; VerticeIndex < UE_ARRAY_COUNT(Vertices); ++VerticeIndex)
406
+ {
407
+ FVector2D ScreenPoint;
408
+ if (FSceneView::ProjectWorldToScreen(Vertices[VerticeIndex], ViewRect, ViewProjectionMatrix, ScreenPoint))
409
+ {
410
+ Box2D += ScreenPoint;
411
+ }
412
+ }
413
+
414
+ return Box2D;
415
+ }
416
+
417
+ ///////////////////////////////////////////////////////////////////
418
+ // UAimAssistInputModifier
419
+
420
+ static const float GamepadUserOptions_YawLookRateBase = 900.0f;
421
+ static const float GamepadUserOptions_PitchLookRateBase = (GamepadUserOptions_YawLookRateBase * 0.6f);
422
+
423
+ // TODO Make this a constexpr instead of a define
424
+ #define YawLookSpeedToRotationRate(_Speed) ((_Speed) / 100.0f * GamepadUserOptions_YawLookRateBase)
425
+ #define PitchLookSpeedToRotationRate(_Speed) ((_Speed) / 100.0f * GamepadUserOptions_PitchLookRateBase)
426
+
427
+ FRotator UAimAssistInputModifier::GetLookRates(const FVector& LookInput)
428
+ {
429
+ FRotator LookRates;
430
+
431
+ const float SensitivityHipLevel = 50.0f;
432
+ {
433
+ LookRates.Yaw = YawLookSpeedToRotationRate(SensitivityHipLevel);
434
+ LookRates.Pitch = PitchLookSpeedToRotationRate(SensitivityHipLevel);
435
+ LookRates.Roll = 0.0f;
436
+ }
437
+
438
+ LookRates.Yaw = FMath::Clamp(LookRates.Yaw, 0.0f, GamepadUserOptions_YawLookRateBase);
439
+ LookRates.Pitch = FMath::Clamp(LookRates.Pitch, 0.0f, GamepadUserOptions_PitchLookRateBase);
440
+
441
+ if (Settings.bUseRadialLookRates)
442
+ {
443
+ // Blend between yaw and pitch based on stick deflection. This keeps diagonals accurate.
444
+ const float RadialLerp = FMath::Atan2(FMath::Abs(LookInput.Y), FMath::Abs(LookInput.X)) / HALF_PI;
445
+ const float RadialLookRate = FMath::Lerp(LookRates.Yaw, LookRates.Pitch, RadialLerp);
446
+
447
+ LookRates.Yaw = RadialLookRate;
448
+ LookRates.Pitch = RadialLookRate;
449
+ }
450
+
451
+ return LookRates;
452
+ }
453
+
454
+ FInputActionValue UAimAssistInputModifier::ModifyRaw_Implementation(const UEnhancedPlayerInput* PlayerInput, FInputActionValue CurrentValue, float DeltaTime)
455
+ {
456
+ TRACE_CPUPROFILER_EVENT_SCOPE(UAimAssistInputModifier::ModifyRaw_Implementation);
457
+
458
+ #if ENABLE_DRAW_DEBUG
459
+ if (LyraConsoleVariables::bDrawAimAssistDebug)
460
+ {
461
+ if (!DebugDrawHandle.IsValid())
462
+ {
463
+ DebugDrawHandle = UDebugDrawService::Register(TEXT("Game"), FDebugDrawDelegate::CreateUObject(this, &UAimAssistInputModifier::AimAssistDebugDraw));
464
+ }
465
+ else
466
+ {
467
+ UDebugDrawService::Unregister(DebugDrawHandle);
468
+ DebugDrawHandle.Reset();
469
+ }
470
+ bRegisteredDebug = true;
471
+ }
472
+ #endif
473
+
474
+ #if !UE_BUILD_SHIPPING
475
+ if (!LyraConsoleVariables::bEnableAimAssist)
476
+ {
477
+ return CurrentValue;
478
+ }
479
+ #endif //UE_BUILD_SHIPPING
480
+
481
+ APlayerController* PC = PlayerInput ? Cast<APlayerController>(PlayerInput->GetOuter()) : nullptr;
482
+ if (!PC)
483
+ {
484
+ return CurrentValue;
485
+ }
486
+
487
+ // Update the "owner" information based on our current player controller. This calculates and stores things like the view matrix
488
+ // and current rotation that is used to determine what targets are visible
489
+ OwnerViewData.UpdateViewData(PC);
490
+
491
+ if (!OwnerViewData.IsDataValid())
492
+ {
493
+ return CurrentValue;
494
+ }
495
+
496
+ // Swaps the target cache's and determines what targets are currently visible. Updates the score of each target to determine
497
+ // how much pull/slow effect should be applied to each
498
+ UpdateTargetData(DeltaTime);
499
+
500
+ FVector BaselineInput = CurrentValue.Get<FVector>();
501
+
502
+ FVector OutAssistedInput = BaselineInput;
503
+ FVector CurrentMoveInput = MoveInputAction ? PlayerInput->GetActionValue(MoveInputAction).Get<FVector>() : FVector::ZeroVector;
504
+
505
+ // Something about the look rates is incorrect
506
+ FRotator LookRates = GetLookRates(BaselineInput);
507
+
508
+ const FRotator RotationalVelocity = UpdateRotationalVelocity(PC, DeltaTime, BaselineInput, CurrentMoveInput);
509
+
510
+ if (LookRates.Yaw > 0.0f)
511
+ {
512
+ OutAssistedInput.X = (RotationalVelocity.Yaw / LookRates.Yaw);
513
+ OutAssistedInput.X = FMath::Clamp(OutAssistedInput.X, -1.0f, 1.0f);
514
+ }
515
+
516
+ if (LookRates.Pitch > 0.0f)
517
+ {
518
+ OutAssistedInput.Y = (RotationalVelocity.Pitch / LookRates.Pitch);
519
+ OutAssistedInput.Y = FMath::Clamp(OutAssistedInput.Y, -1.0f, 1.0f);
520
+ }
521
+
522
+ #if ENABLE_DRAW_DEBUG
523
+ LastBaselineValue = BaselineInput;
524
+ LastLookRatePitch = LookRates.Pitch;
525
+ LastLookRateYaw = LookRates.Yaw;
526
+ LastOutValue = OutAssistedInput;
527
+ #endif
528
+ return OutAssistedInput;
529
+ }
530
+
531
+ void UAimAssistInputModifier::UpdateTargetData(float DeltaTime)
532
+ {
533
+ if(!ensure(OwnerViewData.PlayerController))
534
+ {
535
+ UE_LOG(LogAimAssist, Error, TEXT("[UAimAssistInputModifier::UpdateTargetData] Invalid player controller in owner view data!"));
536
+ return;
537
+ }
538
+
539
+ UAimAssistTargetManagerComponent* TargetManager = nullptr;
540
+
541
+ if (UWorld* World = OwnerViewData.PlayerController->GetWorld())
542
+ {
543
+ if (AGameStateBase* GameState = World->GetGameState())
544
+ {
545
+ TargetManager = GameState->FindComponentByClass<UAimAssistTargetManagerComponent>();
546
+ }
547
+ }
548
+
549
+ if (!TargetManager)
550
+ {
551
+ return;
552
+ }
553
+
554
+ // Update the targets based on what is visible
555
+ SwapTargetCaches();
556
+ const TArray<FLyraAimAssistTarget>& OldTargetCache = GetPreviousTargetCache();
557
+ TArray<FLyraAimAssistTarget>& NewTargetCache = GetCurrentTargetCache();
558
+
559
+ TargetManager->GetVisibleTargets(Filter, Settings, OwnerViewData, OldTargetCache, NewTargetCache);
560
+
561
+ //
562
+ // Update target weights.
563
+ //
564
+ float TotalAssistWeight = 0.0f;
565
+
566
+ for (FLyraAimAssistTarget& Target : NewTargetCache)
567
+ {
568
+ if (Target.bUnderAssistOuterReticle && Target.bIsVisible)
569
+ {
570
+ const float MaxAssistTime = Settings.GetTargetWeightMaxTime();
571
+ Target.AssistTime = FMath::Min((Target.AssistTime + DeltaTime), MaxAssistTime);
572
+ }
573
+ else
574
+ {
575
+ Target.AssistTime = FMath::Max((Target.AssistTime - DeltaTime), 0.0f);
576
+ }
577
+
578
+ // Look up assist weight based on how long the target has been under the assist reticle.
579
+ Target.AssistWeight = Settings.GetTargetWeightForTime(Target.AssistTime);
580
+
581
+ TotalAssistWeight += Target.AssistWeight;
582
+ }
583
+
584
+ // Normalize the weights.
585
+ if (TotalAssistWeight > 0.0f)
586
+ {
587
+ for (FLyraAimAssistTarget& Target : NewTargetCache)
588
+ {
589
+ Target.AssistWeight = (Target.AssistWeight / TotalAssistWeight);
590
+ }
591
+ }
592
+ }
593
+
594
+ const float UAimAssistInputModifier::GetSensitivtyScalar(const ULyraSettingsShared* SharedSettings) const
595
+ {
596
+ if (SharedSettings && SensitivityLevelTable)
597
+ {
598
+ const ELyraGamepadSensitivity Sens = TargetingType == ELyraTargetingType::Normal ? SharedSettings->GetGamepadLookSensitivityPreset() : SharedSettings->GetGamepadTargetingSensitivityPreset();
599
+ return SensitivityLevelTable->SensitivtyEnumToFloat(Sens);
600
+ }
601
+
602
+ UE_LOG(LogAimAssist, Warning, TEXT("SensitivityLevelTable is null, using default value!"));
603
+ return (TargetingType == ELyraTargetingType::Normal) ? 1.0f : 0.5f;
604
+ }
605
+
606
+ FRotator UAimAssistInputModifier::UpdateRotationalVelocity(APlayerController* PC, float DeltaTime, FVector CurrentLookInputValue, FVector CurrentMoveInputValue)
607
+ {
608
+ FRotator RotationalVelocity(ForceInitToZero);
609
+ FRotator RotationNeeded(ForceInitToZero);
610
+
611
+ float PullStrength = 0.0f;
612
+ float SlowStrength = 0.0f;
613
+
614
+ const TArray<FLyraAimAssistTarget>& TargetCache = GetCurrentTargetCache();
615
+
616
+ float LookStickDeadzone = 0.25f;
617
+ float MoveStickDeadzone = 0.25f;
618
+ float SettingStrengthScalar = (TargetingType == ELyraTargetingType::Normal) ? 1.0f : 0.5f;
619
+
620
+ if (ULyraLocalPlayer* LP = Cast<ULyraLocalPlayer>(PC->GetLocalPlayer()))
621
+ {
622
+ ULyraSettingsShared* SharedSettings = LP->GetSharedSettings();
623
+ LookStickDeadzone = SharedSettings->GetGamepadLookStickDeadZone();
624
+ MoveStickDeadzone = SharedSettings->GetGamepadMoveStickDeadZone();
625
+ SettingStrengthScalar = GetSensitivtyScalar(SharedSettings);
626
+ }
627
+
628
+ for (const FLyraAimAssistTarget& Target : TargetCache)
629
+ {
630
+ if (Target.bUnderAssistOuterReticle && Target.bIsVisible)
631
+ {
632
+ // Add up total rotation needed to follow weighted targets based on target and player movement.
633
+ RotationNeeded += (Target.GetRotationFromMovement(OwnerViewData) * Target.AssistWeight);
634
+
635
+ float TargetPullStrength = 0.0f;
636
+ float TargetSlowStrength = 0.0f;
637
+ CalculateTargetStrengths(Target, TargetPullStrength, TargetSlowStrength);
638
+
639
+ // Add up total amount of weighted pull and slow from the targets.
640
+ PullStrength += TargetPullStrength;
641
+ SlowStrength += TargetSlowStrength;
642
+ }
643
+ }
644
+
645
+ // You could also apply some scalars based on the current weapon that is equipped, the player's movement state,
646
+ // or any other factors you want here
647
+ PullStrength *= Settings.StrengthScale * SettingStrengthScalar;
648
+ SlowStrength *= Settings.StrengthScale * SettingStrengthScalar;
649
+
650
+ const float PullLerpRate = (PullStrength > LastPullStrength) ? Settings.PullLerpInRate.GetValue() : Settings.PullLerpOutRate.GetValue();
651
+ if (PullLerpRate > 0.0f)
652
+ {
653
+ PullStrength = FMath::FInterpConstantTo(LastPullStrength, PullStrength, DeltaTime, PullLerpRate);
654
+ }
655
+
656
+ const float SlowLerpRate = (SlowStrength > LastSlowStrength) ? Settings.SlowLerpInRate.GetValue() : Settings.SlowLerpOutRate.GetValue();
657
+ if (SlowLerpRate > 0.0f)
658
+ {
659
+ SlowStrength = FMath::FInterpConstantTo(LastSlowStrength, SlowStrength, DeltaTime, SlowLerpRate);
660
+ }
661
+
662
+ LastPullStrength = PullStrength;
663
+ LastSlowStrength = SlowStrength;
664
+
665
+ const bool bIsLookInputActive = (CurrentLookInputValue.SizeSquared() > FMath::Square(LookStickDeadzone));
666
+ const bool bIsMoveInputActive = (CurrentMoveInputValue.SizeSquared() > FMath::Square(MoveStickDeadzone));
667
+
668
+ const bool bIsApplyingLookInput = (bIsLookInputActive || !Settings.bRequireInput);
669
+ const bool bIsApplyingMoveInput = (bIsMoveInputActive || !Settings.bRequireInput);
670
+ const bool bIsApplyingAnyInput = (bIsApplyingLookInput || bIsApplyingMoveInput);
671
+
672
+ // Apply pulling towards the target
673
+ if (Settings.bApplyPull && bIsApplyingAnyInput && !FMath::IsNearlyZero(PullStrength))
674
+ {
675
+ // The amount of pull is a percentage of the rotation needed to stay on target.
676
+ FRotator PullRotation = (RotationNeeded * PullStrength);
677
+
678
+ if (!bIsApplyingLookInput && Settings.bApplyStrafePullScale)
679
+ {
680
+ // Scale pull strength by amount of player strafe if the player isn't actively looking around.
681
+ // This helps prevent view yanks when running forward past targets.
682
+ float StrafePullScale = FMath::Abs(CurrentMoveInputValue.Y);
683
+
684
+ PullRotation.Yaw *= StrafePullScale;
685
+ PullRotation.Pitch *= StrafePullScale;
686
+ }
687
+
688
+ // Clamp the maximum amount of pull rotation to prevent it from yanking the player's view too much.
689
+ // The clamped rate is scaled so it feels the same regardless of field of view.
690
+ const float FOVScale = UAimAssistTargetManagerComponent::GetFOVScale(PC, ECommonInputType::Gamepad);
691
+ const float PullMaxRotationRate = (Settings.PullMaxRotationRate.GetValue() * FOVScale);
692
+ if (PullMaxRotationRate > 0.0f)
693
+ {
694
+ const float PullMaxRotation = (PullMaxRotationRate * DeltaTime);
695
+
696
+ PullRotation.Yaw = FMath::Clamp(PullRotation.Yaw, -PullMaxRotation, PullMaxRotation);
697
+ PullRotation.Pitch = FMath::Clamp(PullRotation.Pitch, -PullMaxRotation, PullMaxRotation);
698
+ }
699
+
700
+ RotationNeeded -= PullRotation;
701
+ RotationalVelocity += (PullRotation * (1.0f / DeltaTime));
702
+ }
703
+
704
+ FRotator LookRates = GetLookRates(CurrentLookInputValue);
705
+
706
+ // Apply slowing
707
+ if (Settings.bApplySlowing && bIsApplyingLookInput && !FMath::IsNearlyZero(SlowStrength))
708
+ {
709
+ // The slowed rotation rate is a percentage of the normal look rotation rates.
710
+ FRotator SlowRates = (LookRates * (1.0f - SlowStrength));
711
+
712
+ const bool bUseDynamicSlow = true;
713
+
714
+ if (Settings.bUseDynamicSlow)
715
+ {
716
+ const FRotator BoostRotation = (RotationNeeded * (1.0f / DeltaTime));
717
+
718
+ const float YawDynamicBoost = (BoostRotation.Yaw * FMath::Sign(CurrentLookInputValue.X));
719
+ if (YawDynamicBoost > 0.0f)
720
+ {
721
+ SlowRates.Yaw += YawDynamicBoost;
722
+ }
723
+
724
+ const float PitchDynamicBoost = (BoostRotation.Pitch * FMath::Sign(CurrentLookInputValue.Y));
725
+ if (PitchDynamicBoost > 0.0f)
726
+ {
727
+ SlowRates.Pitch += PitchDynamicBoost;
728
+ }
729
+ }
730
+
731
+ // Clamp the minimum amount of slow to prevent it from feeling sluggish on low sensitivity settings.
732
+ // The clamped rate is scaled so it feels the same regardless of field of view.
733
+ const float FOVScale = UAimAssistTargetManagerComponent::GetFOVScale(PC, ECommonInputType::Gamepad);
734
+ const float SlowMinRotationRate = (Settings.SlowMinRotationRate.GetValue() * FOVScale);
735
+ if (SlowMinRotationRate > 0.0f)
736
+ {
737
+ SlowRates.Yaw = FMath::Max(SlowRates.Yaw, SlowMinRotationRate);
738
+ SlowRates.Pitch = FMath::Max(SlowRates.Pitch, SlowMinRotationRate);
739
+ }
740
+
741
+ // Make sure the slow rate isn't faster then our default.
742
+ SlowRates.Yaw = FMath::Min(SlowRates.Yaw, LookRates.Yaw);
743
+ SlowRates.Pitch = FMath::Min(SlowRates.Pitch, LookRates.Pitch);
744
+
745
+ RotationalVelocity.Yaw += (CurrentLookInputValue.X * SlowRates.Yaw);
746
+ RotationalVelocity.Pitch += (CurrentLookInputValue.Y * SlowRates.Pitch);
747
+ RotationalVelocity.Roll = 0.0f;
748
+ }
749
+ else
750
+ {
751
+ RotationalVelocity.Yaw += (CurrentLookInputValue.X * LookRates.Yaw);
752
+ RotationalVelocity.Pitch += (CurrentLookInputValue.Y * LookRates.Pitch);
753
+ RotationalVelocity.Roll = 0.0f;
754
+ }
755
+
756
+ return RotationalVelocity;
757
+ }
758
+
759
+ void UAimAssistInputModifier::CalculateTargetStrengths(const FLyraAimAssistTarget& Target, float& OutPullStrength, float& OutSlowStrength) const
760
+ {
761
+ const bool bIsADS = (TargetingType == ELyraTargetingType::ADS);
762
+
763
+ if (Target.bUnderAssistInnerReticle)
764
+ {
765
+ if (bIsADS)
766
+ {
767
+ OutPullStrength = Settings.PullInnerStrengthAds.GetValue();
768
+ OutSlowStrength = Settings.SlowInnerStrengthAds.GetValue();
769
+ }
770
+ else
771
+ {
772
+ OutPullStrength = Settings.PullInnerStrengthHip.GetValue();
773
+ OutSlowStrength = Settings.SlowInnerStrengthHip.GetValue();
774
+ }
775
+ }
776
+ else if (Target.bUnderAssistOuterReticle)
777
+ {
778
+ if (bIsADS)
779
+ {
780
+ OutPullStrength = Settings.PullOuterStrengthAds.GetValue();
781
+ OutSlowStrength = Settings.SlowOuterStrengthAds.GetValue();
782
+ }
783
+ else
784
+ {
785
+ OutPullStrength = Settings.PullOuterStrengthHip.GetValue();
786
+ OutSlowStrength = Settings.SlowOuterStrengthHip.GetValue();
787
+ }
788
+ }
789
+ else
790
+ {
791
+ OutPullStrength = 0.0f;
792
+ OutSlowStrength = 0.0f;
793
+ }
794
+
795
+ OutPullStrength *= Target.AssistWeight;
796
+ OutSlowStrength *= Target.AssistWeight;
797
+ }
798
+
799
+ #if ENABLE_DRAW_DEBUG
800
+ void UAimAssistInputModifier::AimAssistDebugDraw(UCanvas* Canvas, APlayerController* PC)
801
+ {
802
+ if (!Canvas || !OwnerViewData.IsDataValid() || !LyraConsoleVariables::bDrawAimAssistDebug)
803
+ {
804
+ return;
805
+ }
806
+
807
+ const bool bIsADS = (TargetingType == ELyraTargetingType::ADS);
808
+
809
+ FDisplayDebugManager& DisplayDebugManager = Canvas->DisplayDebugManager;
810
+ DisplayDebugManager.Initialize(Canvas, GEngine->GetSmallFont(), FVector2D((bIsADS ? 4.0f : 170.0f), 150.0f));
811
+ DisplayDebugManager.SetDrawColor(FColor::Yellow);
812
+
813
+ DisplayDebugManager.DrawString(FString(TEXT("------------------------------")));
814
+ DisplayDebugManager.DrawString(FString(TEXT("Aim Assist Debug Draw")));
815
+ DisplayDebugManager.DrawString(FString(TEXT("------------------------------")));
816
+ DisplayDebugManager.DrawString(FString::Printf(TEXT("Strength Scale: (%.4f)"), Settings.StrengthScale));
817
+ DisplayDebugManager.DrawString(FString::Printf(TEXT("Pull Strength: (%.4f)"), LastPullStrength));
818
+ DisplayDebugManager.DrawString(FString::Printf(TEXT("Slow Strength: (%.4f)"), LastSlowStrength));
819
+ DisplayDebugManager.DrawString(FString::Printf(TEXT("Look Rate Yaw: (%.4f)"), LastLookRateYaw));
820
+ DisplayDebugManager.DrawString(FString::Printf(TEXT("Look Rate Pitch: (%.4f)"), LastLookRatePitch));
821
+ DisplayDebugManager.DrawString(FString::Printf(TEXT("Baseline Value: (%.4f, %.4f, %.4f)"), LastBaselineValue.X, LastBaselineValue.Y, LastBaselineValue.Z));
822
+ DisplayDebugManager.DrawString(FString::Printf(TEXT("Assisted Value: (%.4f, %.4f, %.4f)"), LastOutValue.X, LastOutValue.Y, LastOutValue.Z));
823
+
824
+
825
+ UWorld* World = OwnerViewData.PlayerController->GetWorld();
826
+ check(World);
827
+
828
+ const FBox2D AssistInnerReticleBounds = OwnerViewData.ProjectReticleToScreen(Settings.AssistInnerReticleWidth.GetValue(), Settings.AssistInnerReticleHeight.GetValue(), Settings.ReticleDepth);
829
+ const FBox2D AssistOuterReticleBounds = OwnerViewData.ProjectReticleToScreen(Settings.AssistOuterReticleWidth.GetValue(), Settings.AssistOuterReticleHeight.GetValue(), Settings.ReticleDepth);
830
+ const FBox2D TargetingReticleBounds = OwnerViewData.ProjectReticleToScreen(Settings.TargetingReticleWidth.GetValue(), Settings.TargetingReticleHeight.GetValue(), Settings.ReticleDepth);
831
+
832
+ if (TargetingReticleBounds.bIsValid)
833
+ {
834
+ FLinearColor ReticleColor(0.25f, 0.25f, 0.25f, 1.0f);
835
+ DrawDebugCanvas2DBox(Canvas, TargetingReticleBounds, ReticleColor, 1.0f);
836
+ }
837
+
838
+ if (AssistInnerReticleBounds.bIsValid)
839
+ {
840
+ FLinearColor ReticleColor(0.0f, 0.0f, 1.0f, 0.2f);
841
+
842
+ FCanvasTileItem ReticleTileItem(AssistInnerReticleBounds.Min, AssistInnerReticleBounds.GetSize(), ReticleColor);
843
+ ReticleTileItem.BlendMode = SE_BLEND_Translucent;
844
+ Canvas->DrawItem(ReticleTileItem);
845
+
846
+ ReticleColor.A = 1.0f;
847
+ DrawDebugCanvas2DBox(Canvas, AssistInnerReticleBounds, ReticleColor, 1.0f);
848
+ }
849
+
850
+ if (AssistOuterReticleBounds.bIsValid)
851
+ {
852
+ FLinearColor ReticleColor(0.25f, 0.25f, 1.0f, 0.2f);
853
+
854
+ FCanvasTileItem ReticleTileItem(AssistOuterReticleBounds.Min, AssistOuterReticleBounds.GetSize(), ReticleColor);
855
+ ReticleTileItem.BlendMode = SE_BLEND_Translucent;
856
+ Canvas->DrawItem(ReticleTileItem);
857
+
858
+ ReticleColor.A = 1.0f;
859
+ DrawDebugCanvas2DBox(Canvas, AssistOuterReticleBounds, ReticleColor, 1.0f);
860
+ }
861
+
862
+ const TArray<FLyraAimAssistTarget>& TargetCache = GetCurrentTargetCache();
863
+ for (const FLyraAimAssistTarget& Target : TargetCache)
864
+ {
865
+ if (Target.ScreenBounds.bIsValid)
866
+ {
867
+ FLinearColor TargetColor = ((Target.AssistWeight > 0.0f) ? FLinearColor::LerpUsingHSV(FLinearColor::Yellow, FLinearColor::Green, Target.AssistWeight) : FLinearColor::Black);
868
+ TargetColor.A = 0.2f;
869
+
870
+ FCanvasTileItem TargetTileItem(Target.ScreenBounds.Min, Target.ScreenBounds.GetSize(), TargetColor);
871
+ TargetTileItem.BlendMode = SE_BLEND_Translucent;
872
+ Canvas->DrawItem(TargetTileItem);
873
+
874
+ if (Target.bIsVisible)
875
+ {
876
+ TargetColor.A = 1.0f;
877
+ DrawDebugCanvas2DBox(Canvas, Target.ScreenBounds, TargetColor, 1.0f);
878
+ }
879
+
880
+ FCanvasTextItem TargetTextItem(FVector2D::ZeroVector, FText::FromString(FString::Printf(TEXT("Weight: %.2f\nDist: %.2f\nScore: %.2f\nTime: %.2f"), Target.AssistWeight, Target.ViewDistance, Target.SortScore, Target.AssistTime)), GEngine->GetSmallFont(), FLinearColor::White);
881
+ TargetTextItem.EnableShadow(FLinearColor::Black);
882
+ Canvas->DrawItem(TargetTextItem, FVector2D(FMath::CeilToFloat(Target.ScreenBounds.Min.X), FMath::CeilToFloat(Target.ScreenBounds.Min.Y)));
883
+ }
884
+ }
885
+ }
886
+ #endif // ENABLE_DRAW_DEBUG
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Input/AimAssistTargetComponent.cpp ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "Input/AimAssistTargetComponent.h"
4
+
5
+ #include "Input/IAimAssistTargetInterface.h"
6
+
7
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(AimAssistTargetComponent)
8
+
9
+ void UAimAssistTargetComponent::GatherTargetOptions(FAimAssistTargetOptions& OutTargetData)
10
+ {
11
+ if (!TargetData.TargetShapeComponent.IsValid())
12
+ {
13
+ if (AActor* Owner = GetOwner())
14
+ {
15
+ TargetData.TargetShapeComponent = Owner->FindComponentByClass<UShapeComponent>();
16
+ }
17
+ }
18
+ OutTargetData = TargetData;
19
+ }
20
+
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/Input/AimAssistTargetManagerComponent.cpp ADDED
@@ -0,0 +1,489 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "Input/AimAssistTargetManagerComponent.h"
4
+ #include "CommonInputTypeEnum.h"
5
+ #include "Engine/OverlapResult.h"
6
+ #include "Engine/World.h"
7
+ #include "GameFramework/InputSettings.h"
8
+ #include "GameFramework/Character.h"
9
+ #include "GameFramework/InputSettings.h"
10
+ #include "Components/CapsuleComponent.h"
11
+ #include "Components/SkeletalMeshComponent.h"
12
+ #include "Character/LyraHealthComponent.h"
13
+ #include "Input/AimAssistInputModifier.h"
14
+ #include "Player/LyraPlayerState.h"
15
+ #include "Character/LyraHealthComponent.h"
16
+ #include "Input/IAimAssistTargetInterface.h"
17
+ #include "ShooterCoreRuntimeSettings.h"
18
+
19
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(AimAssistTargetManagerComponent)
20
+
21
+ namespace LyraConsoleVariables
22
+ {
23
+ static bool bDrawDebugViewfinder = false;
24
+ static FAutoConsoleVariableRef CVarDrawDebugViewfinder(
25
+ TEXT("lyra.Weapon.AimAssist.DrawDebugViewfinder"),
26
+ bDrawDebugViewfinder,
27
+ TEXT("Should we draw a debug box for the aim assist target viewfinder?"),
28
+ ECVF_Cheat);
29
+ }
30
+
31
+ const FLyraAimAssistTarget* FindTarget(const TArray<FLyraAimAssistTarget>& Targets, const UShapeComponent* TargetComponent)
32
+ {
33
+ const FLyraAimAssistTarget* FoundTarget = Targets.FindByPredicate(
34
+ [&TargetComponent](const FLyraAimAssistTarget& Target)
35
+ {
36
+ return (Target.TargetShapeComponent == TargetComponent);
37
+ });
38
+
39
+ return FoundTarget;
40
+ }
41
+
42
+ static bool GatherTargetInfo(const AActor* Actor, const UShapeComponent* ShapeComponent, FTransform& OutTransform, FCollisionShape& OutShape, FVector& OutShapeOrigin)
43
+ {
44
+ check(Actor);
45
+ check(ShapeComponent);
46
+
47
+ const FCollisionShape TargetShape = ShapeComponent->GetCollisionShape();
48
+ const bool bIsValidShape = (TargetShape.IsBox() || TargetShape.IsSphere() || TargetShape.IsCapsule());
49
+
50
+ if (!bIsValidShape || TargetShape.IsNearlyZero())
51
+ {
52
+ return false;
53
+ }
54
+
55
+ FTransform TargetTransform;
56
+ FVector TargetShapeOrigin(ForceInitToZero);
57
+
58
+ if (const ACharacter* TargetCharacter = Cast<ACharacter>(Actor))
59
+ {
60
+ if (ShapeComponent == TargetCharacter->GetCapsuleComponent())
61
+ {
62
+ // Character capsules don't move smoothly for remote players. Use the mesh location since it's smoothed out.
63
+ const USkeletalMeshComponent* TargetMesh = TargetCharacter->GetMesh();
64
+ check(TargetMesh);
65
+
66
+ TargetTransform = TargetMesh->GetComponentTransform();
67
+ TargetShapeOrigin = -TargetCharacter->GetBaseTranslationOffset();
68
+ }
69
+ else
70
+ {
71
+ TargetTransform = ShapeComponent->GetComponentTransform();
72
+ }
73
+ }
74
+ else
75
+ {
76
+ TargetTransform = ShapeComponent->GetComponentTransform();
77
+ }
78
+
79
+ OutTransform = TargetTransform;
80
+ OutShape = TargetShape;
81
+ OutShapeOrigin = TargetShapeOrigin;
82
+
83
+ return true;
84
+ }
85
+
86
+
87
+ void UAimAssistTargetManagerComponent::GetVisibleTargets(const FAimAssistFilter& Filter, const FAimAssistSettings& Settings, const FAimAssistOwnerViewData& OwnerData, const TArray<FLyraAimAssistTarget>& OldTargets, OUT TArray<FLyraAimAssistTarget>& OutNewTargets)
88
+ {
89
+ TRACE_CPUPROFILER_EVENT_SCOPE(UAimAssistTargetManagerComponent::GetVisibleTargets);
90
+ OutNewTargets.Reset();
91
+ const APlayerController* PC = OwnerData.PlayerController;
92
+
93
+ if (!PC)
94
+ {
95
+ UE_LOG(LogAimAssist, Error, TEXT("Invalid player controller passed to GetVisibleTargets!"));
96
+ return;
97
+ }
98
+
99
+ const APawn* OwnerPawn = PC->GetPawn();
100
+
101
+ if (!OwnerPawn)
102
+ {
103
+ UE_LOG(LogAimAssist, Error, TEXT("Could not find a valid pawn for aim assist!"));
104
+ return;
105
+ }
106
+
107
+ const FVector ViewLocation = OwnerData.ViewTransform.GetTranslation();
108
+ const FVector ViewForward = OwnerData.ViewTransform.GetUnitAxis(EAxis::X);
109
+
110
+ const float FOVScale = GetFOVScale(PC, ECommonInputType::Gamepad);
111
+ const float InvFieldOfViewScale = (FOVScale > 0.0f) ? (1.0f / FOVScale) : 1.0f;
112
+ const float TargetRange = (Settings.TargetRange.GetValue() * InvFieldOfViewScale);
113
+
114
+ // Use the field of view to scale the reticle projection. This maintains the same reticle size regardless of field of view.
115
+ const float ReticleDepth = (Settings.ReticleDepth * InvFieldOfViewScale);
116
+
117
+ // Calculate the bounds of this reticle in screen space
118
+ const FBox2D AssistInnerReticleBounds = OwnerData.ProjectReticleToScreen(Settings.AssistInnerReticleWidth.GetValue(), Settings.AssistInnerReticleHeight.GetValue(), ReticleDepth);
119
+ const FBox2D AssistOuterReticleBounds = OwnerData.ProjectReticleToScreen(Settings.AssistOuterReticleWidth.GetValue(), Settings.AssistOuterReticleHeight.GetValue(), ReticleDepth);
120
+ const FBox2D TargetingReticleBounds = OwnerData.ProjectReticleToScreen(Settings.TargetingReticleWidth.GetValue(), Settings.TargetingReticleHeight.GetValue(), ReticleDepth);
121
+
122
+ static TArray<FOverlapResult> OverlapResults;
123
+ // Do a world trace on the Aim Assist channel to get any visible targets
124
+ {
125
+ UWorld* World = GetWorld();
126
+
127
+ OverlapResults.Reset();
128
+
129
+ const FVector PawnLocation = OwnerPawn->GetActorLocation();
130
+ ECollisionChannel AimAssistChannel = GetAimAssistChannel();
131
+ FCollisionQueryParams Params(SCENE_QUERY_STAT(AimAssist_QueryTargetsInRange), true);
132
+ Params.AddIgnoredActor(OwnerPawn);
133
+
134
+ // Need to multiply these by 0.5 because MakeBox takes in half extents
135
+ FCollisionShape BoxShape = FCollisionShape::MakeBox(FVector3f(ReticleDepth * 0.5f, Settings.AssistOuterReticleWidth.GetValue() * 0.5f, Settings.AssistOuterReticleHeight.GetValue() * 0.5f));
136
+ World->OverlapMultiByChannel(OUT OverlapResults, PawnLocation, OwnerData.PlayerTransform.GetRotation(), AimAssistChannel, BoxShape, Params);
137
+
138
+ #if ENABLE_DRAW_DEBUG && !UE_BUILD_SHIPPING
139
+ if(LyraConsoleVariables::bDrawDebugViewfinder)
140
+ {
141
+ DrawDebugBox(World, PawnLocation, BoxShape.GetBox(), OwnerData.PlayerTransform.GetRotation(), FColor::Red);
142
+ }
143
+ #endif
144
+ }
145
+
146
+ // Gather target options from any visibile hit results that implement the IAimAssistTarget interface
147
+ TArray<FAimAssistTargetOptions> NewTargetData;
148
+ {
149
+ for (const FOverlapResult& Overlap : OverlapResults)
150
+ {
151
+ TScriptInterface<IAimAssistTaget> TargetActor(Overlap.GetActor());
152
+ if (TargetActor)
153
+ {
154
+ FAimAssistTargetOptions TargetData;
155
+ TargetActor->GatherTargetOptions(TargetData);
156
+ NewTargetData.Add(TargetData);
157
+ }
158
+
159
+ TScriptInterface<IAimAssistTaget> TargetComponent(Overlap.GetComponent());
160
+ if (TargetComponent)
161
+ {
162
+ FAimAssistTargetOptions TargetData;
163
+ TargetComponent->GatherTargetOptions(TargetData);
164
+ NewTargetData.Add(TargetData);
165
+ }
166
+ }
167
+ }
168
+
169
+ // Gather targets that are in front of the player
170
+ {
171
+ const FVector PawnLocation = OwnerPawn->GetActorLocation();
172
+
173
+ for (FAimAssistTargetOptions& AimAssistTarget : NewTargetData)
174
+ {
175
+ if (!DoesTargetPassFilter(OwnerData, Filter, AimAssistTarget, TargetRange))
176
+ {
177
+ continue;
178
+ }
179
+
180
+ AActor* OwningActor = AimAssistTarget.TargetShapeComponent->GetOwner();
181
+
182
+ FTransform TargetTransform;
183
+ FCollisionShape TargetShape;
184
+ FVector TargetShapeOrigin;
185
+
186
+ if (!GatherTargetInfo(OwningActor, AimAssistTarget.TargetShapeComponent.Get(), TargetTransform, TargetShape, TargetShapeOrigin))
187
+ {
188
+ continue;
189
+ }
190
+
191
+ const FVector TargetViewLocation = TargetTransform.TransformPositionNoScale(TargetShapeOrigin);
192
+ const FVector TargetViewVector = (TargetViewLocation - ViewLocation);
193
+
194
+ FVector TargetViewDirection;
195
+ float TargetViewDistance;
196
+ TargetViewVector.ToDirectionAndLength(TargetViewDirection, TargetViewDistance);
197
+ const float TargetViewDot = FVector::DotProduct(TargetViewDirection, ViewForward);
198
+ if (TargetViewDot <= 0.0f)
199
+ {
200
+ continue;
201
+ }
202
+
203
+ const FLyraAimAssistTarget* OldTarget = FindTarget(OldTargets, AimAssistTarget.TargetShapeComponent.Get());
204
+
205
+ // Calculate the screen bounds for this target
206
+ FBox2D TargetScreenBounds(ForceInitToZero);
207
+ const bool bUpdateTargetProjections = true;
208
+ if (bUpdateTargetProjections)
209
+ {
210
+ TargetScreenBounds = OwnerData.ProjectShapeToScreen(TargetShape, TargetShapeOrigin, TargetTransform);
211
+ }
212
+ else
213
+ {
214
+ // Target projections are not being updated so use the values from the previous frame if the target existed.
215
+ if (OldTarget)
216
+ {
217
+ TargetScreenBounds = OldTarget->ScreenBounds;
218
+ }
219
+ }
220
+
221
+ if (!TargetScreenBounds.bIsValid)
222
+ {
223
+ continue;
224
+ }
225
+
226
+ if (!TargetingReticleBounds.Intersect(TargetScreenBounds))
227
+ {
228
+ continue;
229
+ }
230
+
231
+ FLyraAimAssistTarget NewTarget;
232
+
233
+ NewTarget.TargetShapeComponent = AimAssistTarget.TargetShapeComponent;
234
+ NewTarget.Location = TargetTransform.GetTranslation();
235
+ NewTarget.ScreenBounds = TargetScreenBounds;
236
+ NewTarget.ViewDistance = TargetViewDistance;
237
+ NewTarget.bUnderAssistInnerReticle = AssistInnerReticleBounds.Intersect(TargetScreenBounds);
238
+ NewTarget.bUnderAssistOuterReticle = AssistOuterReticleBounds.Intersect(TargetScreenBounds);
239
+
240
+ // Transfer target data from last frame.
241
+ if (OldTarget)
242
+ {
243
+ NewTarget.DeltaMovement = (NewTarget.Location - OldTarget->Location);
244
+ NewTarget.AssistTime = OldTarget->AssistTime;
245
+ NewTarget.AssistWeight = OldTarget->AssistWeight;
246
+ NewTarget.VisibilityTraceHandle = OldTarget->VisibilityTraceHandle;
247
+ }
248
+
249
+ // Calculate a score used for sorting based on previous weight, distance from target, and distance from reticle.
250
+ const float AssistWeightScore = (NewTarget.AssistWeight * Settings.TargetScore_AssistWeight);
251
+ const float ViewDotScore = ((TargetViewDot * Settings.TargetScore_ViewDot) - Settings.TargetScore_ViewDotOffset);
252
+ const float ViewDistanceScore = ((1.0f - (TargetViewDistance / TargetRange)) * Settings.TargetScore_ViewDistance);
253
+
254
+ NewTarget.SortScore = (AssistWeightScore + ViewDotScore + ViewDistanceScore);
255
+
256
+ OutNewTargets.Add(NewTarget);
257
+ }
258
+ }
259
+
260
+ // Sort the targets by their score so if there are too many so we can limit the amount of visibility traces performed.
261
+ if (OutNewTargets.Num() > Settings.MaxNumberOfTargets)
262
+ {
263
+ OutNewTargets.Sort([](const FLyraAimAssistTarget& TargetA, const FLyraAimAssistTarget& TargetB)
264
+ {
265
+ return (TargetA.SortScore > TargetB.SortScore);
266
+ });
267
+
268
+ OutNewTargets.SetNum(Settings.MaxNumberOfTargets, EAllowShrinking::No);
269
+ }
270
+
271
+ // Do visibliity traces on the targets
272
+ {
273
+ for (FLyraAimAssistTarget& Target : OutNewTargets)
274
+ {
275
+ DetermineTargetVisibility(Target, Settings, Filter, OwnerData);
276
+ }
277
+ }
278
+ }
279
+
280
+ bool UAimAssistTargetManagerComponent::DoesTargetPassFilter(const FAimAssistOwnerViewData& OwnerData, const FAimAssistFilter& Filter, const FAimAssistTargetOptions& Target, const float AcceptableRange) const
281
+ {
282
+ const APawn* OwnerPawn = OwnerData.PlayerController ? OwnerData.PlayerController->GetPawn() : nullptr;
283
+
284
+ if (!Target.bIsActive || !OwnerPawn || !Target.TargetShapeComponent.IsValid())
285
+ {
286
+ return false;
287
+ }
288
+
289
+ const AActor* TargetOwningActor = Target.TargetShapeComponent->GetOwner();
290
+ check(TargetOwningActor);
291
+ if (TargetOwningActor == OwnerPawn || TargetOwningActor == OwnerPawn->GetInstigator())
292
+ {
293
+ return false;
294
+ }
295
+
296
+ const FVector PawnLocation = OwnerPawn->GetActorLocation();
297
+
298
+ // Do a distance check on the given actor
299
+ const FVector TargetVector = TargetOwningActor->GetActorLocation() - PawnLocation;
300
+ const float TargetViewDistanceCheck = FVector::DotProduct(OwnerData.ViewForward, TargetVector);
301
+
302
+ if ((TargetViewDistanceCheck < 0.0f) || (TargetViewDistanceCheck > AcceptableRange))
303
+ {
304
+ return false;
305
+ }
306
+
307
+ if (const ACharacter* TargetCharacter = Cast<ACharacter>(TargetOwningActor))
308
+ {
309
+ // If the given target is on the same team as the owner, then exclude it from the search
310
+ if (!Filter.bIncludeSameFriendlyTargets)
311
+ {
312
+ if (const ALyraPlayerState* PS = TargetCharacter->GetPlayerState<ALyraPlayerState>())
313
+ {
314
+ if (PS->GetTeamId() == OwnerData.TeamID)
315
+ {
316
+ return false;
317
+ }
318
+ }
319
+ }
320
+
321
+ // Exclude dead or dying characters
322
+ if (Filter.bExcludeDeadOrDying)
323
+ {
324
+ if (const ULyraHealthComponent* HealthComponent = ULyraHealthComponent::FindHealthComponent(TargetCharacter))
325
+ {
326
+ if (HealthComponent->IsDeadOrDying())
327
+ {
328
+ return false;
329
+ }
330
+ }
331
+ }
332
+ }
333
+
334
+ // If this target has any tags that the filter wants to exlclude, then ignore it
335
+ if (Target.AssociatedTags.HasAny(Filter.ExclusionGameplayTags))
336
+ {
337
+ return false;
338
+ }
339
+
340
+ if (Filter.ExcludedClasses.Contains(TargetOwningActor->GetClass()))
341
+ {
342
+ return false;
343
+ }
344
+
345
+ return true;
346
+ }
347
+
348
+ float UAimAssistTargetManagerComponent::GetFOVScale(const APlayerController* PC, ECommonInputType InputType)
349
+ {
350
+ float FovScale = 1.0f;
351
+ const UInputSettings* DefaultInputSettings = GetDefault<UInputSettings>();
352
+ check(DefaultInputSettings && PC);
353
+
354
+ if (PC->PlayerCameraManager && DefaultInputSettings->bEnableFOVScaling)
355
+ {
356
+ const float FOVAngle = PC->PlayerCameraManager->GetFOVAngle();
357
+ switch (InputType)
358
+ {
359
+ case ECommonInputType::Gamepad:
360
+ case ECommonInputType::Touch:
361
+ {
362
+ static const float PlayerInput_BaseFOV = 80.0f;
363
+ // This is the proper way to scale based off FOV changes.
364
+ // Ideally mouse would use this too but changing it now will cause sensitivity to change for existing players.
365
+ const float BaseHalfFOV = PlayerInput_BaseFOV * 0.5f;
366
+ const float HalfFOV = FOVAngle * 0.5f;
367
+ const float BaseTanHalfFOV = FMath::Tan(FMath::DegreesToRadians(BaseHalfFOV));
368
+ const float TanHalfFOV = FMath::Tan(FMath::DegreesToRadians(HalfFOV));
369
+
370
+ check(BaseTanHalfFOV > 0.0f);
371
+ FovScale = (TanHalfFOV / BaseTanHalfFOV);
372
+ break;
373
+ }
374
+ case ECommonInputType::MouseAndKeyboard:
375
+ FovScale = (DefaultInputSettings->FOVScale * FOVAngle);
376
+ break;
377
+ default:
378
+ ensure(false);
379
+ break;
380
+ }
381
+ }
382
+ return FovScale;
383
+ }
384
+
385
+ void UAimAssistTargetManagerComponent::DetermineTargetVisibility(FLyraAimAssistTarget& Target, const FAimAssistSettings& Settings, const FAimAssistFilter& Filter, const FAimAssistOwnerViewData& OwnerData)
386
+ {
387
+ UWorld* World = GetWorld();
388
+ check(World);
389
+
390
+ const AActor* Actor = Target.TargetShapeComponent->GetOwner();
391
+ if (!Actor)
392
+ {
393
+ ensure(false);
394
+ return;
395
+ }
396
+
397
+ FVector TargetEyeLocation;
398
+ FRotator TargetEyeRotation;
399
+ Actor->GetActorEyesViewPoint(TargetEyeLocation, TargetEyeRotation);
400
+
401
+ FCollisionQueryParams QueryParams(SCENE_QUERY_STAT(AimAssist_DetermineTargetVisibility), true);
402
+ InitTargetSelectionCollisionParams(QueryParams, *Actor, Filter);
403
+ QueryParams.AddIgnoredActor(Actor);
404
+
405
+ const UShooterCoreRuntimeSettings* ShooterSettings = GetDefault<UShooterCoreRuntimeSettings>();
406
+ const ECollisionChannel AimAssistChannel = ShooterSettings->GetAimAssistCollisionChannel();
407
+
408
+ FCollisionResponseParams ResponseParams;
409
+ ResponseParams.CollisionResponse.SetResponse(ECC_Pawn, ECR_Ignore);
410
+ ResponseParams.CollisionResponse.SetResponse(AimAssistChannel, ECR_Ignore);
411
+
412
+ if (Target.bIsVisible && Settings.bEnableAsyncVisibilityTrace)
413
+ {
414
+ // Query for previous asynchronous trace result.
415
+ if (Target.VisibilityTraceHandle.IsValid())
416
+ {
417
+ FTraceDatum TraceDatum;
418
+ if (World->QueryTraceData(Target.VisibilityTraceHandle, TraceDatum))
419
+ {
420
+ Target.bIsVisible = (FHitResult::GetFirstBlockingHit(TraceDatum.OutHits) == nullptr);
421
+ }
422
+ else
423
+ {
424
+ UE_LOG(LogAimAssist, Warning, TEXT("UAimAssistTargetManagerComponent::DetermineTargetVisibility() - Failed to find async visibility trace data!"));
425
+ Target.bIsVisible = false;
426
+ }
427
+
428
+ // Invalidate the async trace handle.
429
+ Target.VisibilityTraceHandle = FTraceHandle();
430
+ }
431
+
432
+ // Only start a new asynchronous trace for next frame if the target is still visible.
433
+ if (Target.bIsVisible)
434
+ {
435
+ Target.VisibilityTraceHandle = World->AsyncLineTraceByChannel(EAsyncTraceType::Test, OwnerData.ViewTransform.GetTranslation(), TargetEyeLocation, ECC_Visibility, QueryParams, ResponseParams);
436
+ }
437
+ }
438
+ else
439
+ {
440
+ Target.bIsVisible = !World->LineTraceTestByChannel(OwnerData.ViewTransform.GetTranslation(), TargetEyeLocation, ECC_Visibility, QueryParams, ResponseParams);
441
+
442
+ // Invalidate the async trace handle.
443
+ Target.VisibilityTraceHandle = FTraceHandle();
444
+ }
445
+ }
446
+
447
+ void UAimAssistTargetManagerComponent::InitTargetSelectionCollisionParams(FCollisionQueryParams& OutParams, const AActor& RequestedBy, const FAimAssistFilter& Filter) const
448
+ {
449
+ // Exclude Requester
450
+ if (Filter.bExcludeRequester)
451
+ {
452
+ OutParams.AddIgnoredActor(&RequestedBy);
453
+ }
454
+
455
+ // Exclude attached to Requester
456
+ if (Filter.bExcludeAllAttachedToRequester)
457
+ {
458
+ TArray<AActor*> ActorsAttachedToRequester;
459
+ RequestedBy.GetAttachedActors(ActorsAttachedToRequester);
460
+
461
+ OutParams.AddIgnoredActors(ActorsAttachedToRequester);
462
+ }
463
+
464
+ if (Filter.bExcludeInstigator)
465
+ {
466
+ OutParams.AddIgnoredActor(RequestedBy.GetInstigator());
467
+ }
468
+
469
+ // Exclude attached to Instigator
470
+ if (Filter.bExcludeAllAttachedToInstigator && RequestedBy.GetInstigator())
471
+ {
472
+ TArray<AActor*> ActorsAttachedToInstigator;
473
+ RequestedBy.GetInstigator()->GetAttachedActors(ActorsAttachedToInstigator);
474
+
475
+ OutParams.AddIgnoredActors(ActorsAttachedToInstigator);
476
+ }
477
+
478
+ OutParams.bTraceComplex = Filter.bTraceComplexCollision;
479
+ }
480
+
481
+ ECollisionChannel UAimAssistTargetManagerComponent::GetAimAssistChannel() const
482
+ {
483
+ const UShooterCoreRuntimeSettings* ShooterSettings = GetDefault<UShooterCoreRuntimeSettings>();
484
+ const ECollisionChannel AimAssistChannel = ShooterSettings->GetAimAssistCollisionChannel();
485
+
486
+ ensureMsgf(AimAssistChannel != ECollisionChannel::ECC_MAX, TEXT("The aim assist collision channel has not been set! Do this in the ShooterCoreRuntime plugin settings"));
487
+
488
+ return AimAssistChannel;
489
+ }
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/LyraWorldCollectable.cpp ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "LyraWorldCollectable.h"
4
+
5
+ #include "Async/TaskGraphInterfaces.h"
6
+
7
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(LyraWorldCollectable)
8
+
9
+ struct FInteractionQuery;
10
+
11
+ ALyraWorldCollectable::ALyraWorldCollectable()
12
+ {
13
+ }
14
+
15
+ void ALyraWorldCollectable::GatherInteractionOptions(const FInteractionQuery& InteractQuery, FInteractionOptionBuilder& InteractionBuilder)
16
+ {
17
+ InteractionBuilder.AddInteractionOption(Option);
18
+ }
19
+
20
+ FInventoryPickup ALyraWorldCollectable::GetPickupInventory() const
21
+ {
22
+ return StaticInventory;
23
+ }
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/MessageProcessors/AssistProcessor.cpp ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "MessageProcessors/AssistProcessor.h"
4
+
5
+ #include "GameFramework/PlayerState.h"
6
+ #include "Messages/LyraVerbMessage.h"
7
+ #include "Messages/LyraVerbMessageHelpers.h"
8
+ #include "NativeGameplayTags.h"
9
+
10
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(AssistProcessor)
11
+
12
+ UE_DEFINE_GAMEPLAY_TAG_STATIC(TAG_Lyra_Elimination_Message, "Lyra.Elimination.Message");
13
+ UE_DEFINE_GAMEPLAY_TAG_STATIC(TAG_Lyra_Damage_Message, "Lyra.Damage.Message");
14
+ UE_DEFINE_GAMEPLAY_TAG_STATIC(TAG_Lyra_Assist_Message, "Lyra.Assist.Message");
15
+
16
+ void UAssistProcessor::StartListening()
17
+ {
18
+ UGameplayMessageSubsystem& MessageSubsystem = UGameplayMessageSubsystem::Get(this);
19
+ AddListenerHandle(MessageSubsystem.RegisterListener(TAG_Lyra_Elimination_Message, this, &ThisClass::OnEliminationMessage));
20
+ AddListenerHandle(MessageSubsystem.RegisterListener(TAG_Lyra_Damage_Message, this, &ThisClass::OnDamageMessage));
21
+ }
22
+
23
+ void UAssistProcessor::OnDamageMessage(FGameplayTag Channel, const FLyraVerbMessage& Payload)
24
+ {
25
+ if (Payload.Instigator != Payload.Target)
26
+ {
27
+ if (APlayerState* InstigatorPS = ULyraVerbMessageHelpers::GetPlayerStateFromObject(Payload.Instigator))
28
+ {
29
+ if (APlayerState* TargetPS = ULyraVerbMessageHelpers::GetPlayerStateFromObject(Payload.Target))
30
+ {
31
+ FPlayerAssistDamageTracking& Damage = DamageHistory.FindOrAdd(TargetPS);
32
+ float& DamageTotalFromTarget = Damage.AccumulatedDamageByPlayer.FindOrAdd(InstigatorPS);
33
+ DamageTotalFromTarget += Payload.Magnitude;
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+
40
+ void UAssistProcessor::OnEliminationMessage(FGameplayTag Channel, const FLyraVerbMessage& Payload)
41
+ {
42
+ if (APlayerState* TargetPS = Cast<APlayerState>(Payload.Target))
43
+ {
44
+ // Grant an assist to each player who damaged the target but wasn't the instigator
45
+ if (FPlayerAssistDamageTracking* DamageOnTarget = DamageHistory.Find(TargetPS))
46
+ {
47
+ for (const auto& KVP : DamageOnTarget->AccumulatedDamageByPlayer)
48
+ {
49
+ if (APlayerState* AssistPS = KVP.Key)
50
+ {
51
+ if (AssistPS != Payload.Instigator)
52
+ {
53
+ FLyraVerbMessage AssistMessage;
54
+ AssistMessage.Verb = TAG_Lyra_Assist_Message;
55
+ AssistMessage.Instigator = AssistPS;
56
+ //@TODO: Get default tags from a player state or save off most recent tags during assist damage?
57
+ //AssistMessage.InstigatorTags = ;
58
+ AssistMessage.Target = TargetPS;
59
+ AssistMessage.TargetTags = Payload.TargetTags;
60
+ AssistMessage.ContextTags = Payload.ContextTags;
61
+ AssistMessage.Magnitude = KVP.Value;
62
+
63
+ UGameplayMessageSubsystem& MessageSubsystem = UGameplayMessageSubsystem::Get(this);
64
+ MessageSubsystem.BroadcastMessage(AssistMessage.Verb, AssistMessage);
65
+ }
66
+ }
67
+ }
68
+
69
+ // Clear the damage log for the eliminated player
70
+ DamageHistory.Remove(TargetPS);
71
+ }
72
+ }
73
+ }
74
+
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/MessageProcessors/ElimChainProcessor.cpp ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "MessageProcessors/ElimChainProcessor.h"
4
+
5
+ #include "GameFramework/PlayerState.h"
6
+ #include "Messages/LyraVerbMessage.h"
7
+ #include "NativeGameplayTags.h"
8
+
9
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(ElimChainProcessor)
10
+
11
+ namespace ElimChain
12
+ {
13
+ UE_DEFINE_GAMEPLAY_TAG_STATIC(TAG_Lyra_Elimination_Message, "Lyra.Elimination.Message");
14
+ }
15
+
16
+ void UElimChainProcessor::StartListening()
17
+ {
18
+ UGameplayMessageSubsystem& MessageSubsystem = UGameplayMessageSubsystem::Get(this);
19
+ AddListenerHandle(MessageSubsystem.RegisterListener(ElimChain::TAG_Lyra_Elimination_Message, this, &ThisClass::OnEliminationMessage));
20
+ }
21
+
22
+ void UElimChainProcessor::OnEliminationMessage(FGameplayTag Channel, const FLyraVerbMessage& Payload)
23
+ {
24
+ // Track elimination chains for the attacker (except for self-eliminations)
25
+ if (Payload.Instigator != Payload.Target)
26
+ {
27
+ if (APlayerState* InstigatorPS = Cast<APlayerState>(Payload.Instigator))
28
+ {
29
+ const double CurrentTime = GetServerTime();
30
+
31
+ FPlayerElimChainInfo& History = PlayerChainHistory.FindOrAdd(InstigatorPS);
32
+ const bool bStreakReset = (History.LastEliminationTime == 0.0) || (History.LastEliminationTime + ChainTimeLimit < CurrentTime);
33
+
34
+ History.LastEliminationTime = CurrentTime;
35
+ if (bStreakReset)
36
+ {
37
+ History.ChainCounter = 1;
38
+ }
39
+ else
40
+ {
41
+ ++History.ChainCounter;
42
+
43
+ if (FGameplayTag* pTag = ElimChainTags.Find(History.ChainCounter))
44
+ {
45
+ FLyraVerbMessage ElimChainMessage;
46
+ ElimChainMessage.Verb = *pTag;
47
+ ElimChainMessage.Instigator = InstigatorPS;
48
+ ElimChainMessage.InstigatorTags = Payload.InstigatorTags;
49
+ ElimChainMessage.ContextTags = Payload.ContextTags;
50
+ ElimChainMessage.Magnitude = History.ChainCounter;
51
+
52
+ UGameplayMessageSubsystem& MessageSubsystem = UGameplayMessageSubsystem::Get(this);
53
+ MessageSubsystem.BroadcastMessage(ElimChainMessage.Verb, ElimChainMessage);
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/MessageProcessors/ElimStreakProcessor.cpp ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "MessageProcessors/ElimStreakProcessor.h"
4
+
5
+ #include "GameFramework/PlayerState.h"
6
+ #include "Messages/LyraVerbMessage.h"
7
+ #include "NativeGameplayTags.h"
8
+
9
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(ElimStreakProcessor)
10
+
11
+ namespace ElimStreak
12
+ {
13
+ UE_DEFINE_GAMEPLAY_TAG_STATIC(TAG_Lyra_Elimination_Message, "Lyra.Elimination.Message");
14
+ }
15
+
16
+ void UElimStreakProcessor::StartListening()
17
+ {
18
+ UGameplayMessageSubsystem& MessageSubsystem = UGameplayMessageSubsystem::Get(this);
19
+ AddListenerHandle(MessageSubsystem.RegisterListener(ElimStreak::TAG_Lyra_Elimination_Message, this, &ThisClass::OnEliminationMessage));
20
+ }
21
+
22
+ void UElimStreakProcessor::OnEliminationMessage(FGameplayTag Channel, const FLyraVerbMessage& Payload)
23
+ {
24
+ // Track elimination streaks for the attacker (except for self-eliminations)
25
+ if (Payload.Instigator != Payload.Target)
26
+ {
27
+ if (APlayerState* InstigatorPS = Cast<APlayerState>(Payload.Instigator))
28
+ {
29
+ int32& StreakCount = PlayerStreakHistory.FindOrAdd(InstigatorPS);
30
+ StreakCount++;
31
+
32
+ if (FGameplayTag* pTag = ElimStreakTags.Find(StreakCount))
33
+ {
34
+ FLyraVerbMessage ElimStreakMessage;
35
+ ElimStreakMessage.Verb = *pTag;
36
+ ElimStreakMessage.Instigator = InstigatorPS;
37
+ ElimStreakMessage.InstigatorTags = Payload.InstigatorTags;
38
+ ElimStreakMessage.ContextTags = Payload.ContextTags;
39
+ ElimStreakMessage.Magnitude = StreakCount;
40
+
41
+ UGameplayMessageSubsystem& MessageSubsystem = UGameplayMessageSubsystem::Get(this);
42
+ MessageSubsystem.BroadcastMessage(ElimStreakMessage.Verb, ElimStreakMessage);
43
+ }
44
+ }
45
+ }
46
+
47
+ // End the elimination streak for the target
48
+ if (APlayerState* TargetPS = Cast<APlayerState>(Payload.Target))
49
+ {
50
+ PlayerStreakHistory.Remove(TargetPS);
51
+ }
52
+ }
53
+
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/ShooterCoreRuntimeModule.cpp ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "ShooterCoreRuntimeModule.h"
4
+
5
+ #include "Modules/ModuleManager.h"
6
+
7
+ #define LOCTEXT_NAMESPACE "ShooterCoreRuntime"
8
+
9
+ void FShooterCoreRuntimeModule::StartupModule()
10
+ {
11
+ }
12
+
13
+ void FShooterCoreRuntimeModule::ShutdownModule()
14
+ {
15
+ }
16
+
17
+ #undef LOCTEXT_NAMESPACE
18
+
19
+ IMPLEMENT_MODULE(FShooterCoreRuntimeModule, ShooterCoreRuntime)
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/ShooterCoreRuntimeSettings.cpp ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "ShooterCoreRuntimeSettings.h"
4
+
5
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(ShooterCoreRuntimeSettings)
6
+
7
+ UShooterCoreRuntimeSettings::UShooterCoreRuntimeSettings(const FObjectInitializer& Initializer)
8
+ : Super(Initializer)
9
+ {
10
+
11
+ }
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/TDM_PlayerSpawningManagmentComponent.cpp ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #include "TDM_PlayerSpawningManagmentComponent.h"
4
+
5
+ #include "Engine/World.h"
6
+ #include "GameFramework/PlayerState.h"
7
+ #include "GameModes/LyraGameState.h"
8
+ #include "Player/LyraPlayerStart.h"
9
+ #include "Teams/LyraTeamSubsystem.h"
10
+
11
+ #include UE_INLINE_GENERATED_CPP_BY_NAME(TDM_PlayerSpawningManagmentComponent)
12
+
13
+ class AActor;
14
+
15
+ UTDM_PlayerSpawningManagmentComponent::UTDM_PlayerSpawningManagmentComponent(const FObjectInitializer& ObjectInitializer)
16
+ : Super(ObjectInitializer)
17
+ {
18
+ }
19
+
20
+ AActor* UTDM_PlayerSpawningManagmentComponent::OnChoosePlayerStart(AController* Player, TArray<ALyraPlayerStart*>& PlayerStarts)
21
+ {
22
+ ULyraTeamSubsystem* TeamSubsystem = GetWorld()->GetSubsystem<ULyraTeamSubsystem>();
23
+ if (!ensure(TeamSubsystem))
24
+ {
25
+ return nullptr;
26
+ }
27
+
28
+ const int32 PlayerTeamId = TeamSubsystem->FindTeamFromObject(Player);
29
+
30
+ // We should have a TeamId by now, but early login stuff before post login can try to do stuff, ignore it.
31
+ if (!ensure(PlayerTeamId != INDEX_NONE))
32
+ {
33
+ return nullptr;
34
+ }
35
+
36
+ ALyraGameState* GameState = GetGameStateChecked<ALyraGameState>();
37
+
38
+ ALyraPlayerStart* BestPlayerStart = nullptr;
39
+ double MaxDistance = 0;
40
+ ALyraPlayerStart* FallbackPlayerStart = nullptr;
41
+ double FallbackMaxDistance = 0;
42
+
43
+ for (APlayerState* PS : GameState->PlayerArray)
44
+ {
45
+ const int32 TeamId = TeamSubsystem->FindTeamFromObject(PS);
46
+
47
+ // We should have a TeamId by now...
48
+ if (PS->IsOnlyASpectator() || !ensure(TeamId != INDEX_NONE))
49
+ {
50
+ continue;
51
+ }
52
+
53
+ // If the other player isn't on the same team, lets find the furthest spawn from them.
54
+ if (TeamId != PlayerTeamId)
55
+ {
56
+ for (ALyraPlayerStart* PlayerStart : PlayerStarts)
57
+ {
58
+ if (APawn* Pawn = PS->GetPawn())
59
+ {
60
+ const double Distance = PlayerStart->GetDistanceTo(Pawn);
61
+
62
+ if (PlayerStart->IsClaimed())
63
+ {
64
+ if (FallbackPlayerStart == nullptr || Distance > FallbackMaxDistance)
65
+ {
66
+ FallbackPlayerStart = PlayerStart;
67
+ FallbackMaxDistance = Distance;
68
+ }
69
+ }
70
+ else if (PlayerStart->GetLocationOccupancy(Player) < ELyraPlayerStartLocationOccupancy::Full)
71
+ {
72
+ if (BestPlayerStart == nullptr || Distance > MaxDistance)
73
+ {
74
+ BestPlayerStart = PlayerStart;
75
+ MaxDistance = Distance;
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
82
+
83
+ if (BestPlayerStart)
84
+ {
85
+ return BestPlayerStart;
86
+ }
87
+
88
+ return FallbackPlayerStart;
89
+ }
90
+
91
+ void UTDM_PlayerSpawningManagmentComponent::OnFinishRestartPlayer(AController* Player, const FRotator& StartRotation)
92
+ {
93
+
94
+ }
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Private/TDM_PlayerSpawningManagmentComponent.h ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Player/LyraPlayerSpawningManagerComponent.h"
6
+
7
+ #include "TDM_PlayerSpawningManagmentComponent.generated.h"
8
+
9
+ class AActor;
10
+ class AController;
11
+ class ALyraPlayerStart;
12
+ class UObject;
13
+
14
+ /**
15
+ *
16
+ */
17
+ UCLASS()
18
+ class UTDM_PlayerSpawningManagmentComponent : public ULyraPlayerSpawningManagerComponent
19
+ {
20
+ GENERATED_BODY()
21
+
22
+ public:
23
+
24
+ UTDM_PlayerSpawningManagmentComponent(const FObjectInitializer& ObjectInitializer);
25
+
26
+ virtual AActor* OnChoosePlayerStart(AController* Player, TArray<ALyraPlayerStart*>& PlayerStarts) override;
27
+ virtual void OnFinishRestartPlayer(AController* Player, const FRotator& StartRotation) override;
28
+
29
+ protected:
30
+
31
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Accolades/LyraAccoladeDefinition.h ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Engine/DataAsset.h"
6
+ #include "Engine/DataTable.h"
7
+ #include "GameplayTagContainer.h"
8
+
9
+ #include "LyraAccoladeDefinition.generated.h"
10
+
11
+ class UObject;
12
+ class USoundBase;
13
+
14
+ USTRUCT(BlueprintType)
15
+ struct FLyraAccoladeDefinitionRow : public FTableRowBase
16
+ {
17
+ GENERATED_BODY()
18
+
19
+ public:
20
+ // The message to display
21
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
22
+ FText DisplayName;
23
+
24
+ // The sound to play
25
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
26
+ TSoftObjectPtr<USoundBase> Sound;
27
+
28
+ // The icon to display
29
+ UPROPERTY(EditAnywhere, BlueprintReadOnly, meta=(DisplayThumbnail="true", AllowedClasses="Texture,MaterialInterface,SlateTextureAtlasInterface", DisallowedClasses="MediaTexture"))
30
+ TSoftObjectPtr<UObject> Icon;
31
+
32
+ // Duration (in seconds) to display this accolade
33
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
34
+ float DisplayDuration = 1.0f;
35
+
36
+ // Location to display this accolade
37
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
38
+ FGameplayTag LocationTag;
39
+
40
+ // Tags associated with this accolade
41
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
42
+ FGameplayTagContainer AccoladeTags;
43
+
44
+ // When this accolade is displayed, any existing displayed/pending accolades with any of
45
+ // these tags will be removed (e.g., getting a triple-elim will suppress a double-elim)
46
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
47
+ FGameplayTagContainer CancelAccoladesWithTag;
48
+ };
49
+
50
+ /**
51
+ *
52
+ */
53
+ UCLASS(BlueprintType)
54
+ class ULyraAccoladeDefinition : public UDataAsset
55
+ {
56
+ GENERATED_BODY()
57
+
58
+ public:
59
+ // The sound to play
60
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
61
+ TObjectPtr<USoundBase> Sound;
62
+
63
+ // The icon to display
64
+ UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(DisplayThumbnail="true", AllowedClasses="Texture,MaterialInterface,SlateTextureAtlasInterface", DisallowedClasses="MediaTexture"))
65
+ TObjectPtr<UObject> Icon;
66
+
67
+ // Tags associated with this accolade
68
+ UPROPERTY(EditAnywhere, BlueprintReadWrite)
69
+ FGameplayTagContainer AccoladeTags;
70
+
71
+ // When this accolade is displayed, any existing displayed/pending accolades with any of
72
+ // these tags will be removed (e.g., getting a triple-elim will suppress a double-elim)
73
+ UPROPERTY(EditAnywhere, BlueprintReadWrite)
74
+ FGameplayTagContainer CancelAccoladesWithTag;
75
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Accolades/LyraAccoladeHostWidget.h ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Accolades/LyraAccoladeDefinition.h"
6
+ #include "AsyncMixin.h"
7
+ #include "CommonUserWidget.h"
8
+ #include "GameFramework/GameplayMessageSubsystem.h"
9
+
10
+ #include "LyraAccoladeHostWidget.generated.h"
11
+
12
+ class UObject;
13
+ class USoundBase;
14
+ class UUserWidget;
15
+ struct FDataRegistryAcquireResult;
16
+ struct FLyraNotificationMessage;
17
+
18
+ USTRUCT(BlueprintType)
19
+ struct FPendingAccoladeEntry
20
+ {
21
+ GENERATED_BODY();
22
+
23
+ UPROPERTY(BlueprintReadOnly)
24
+ FLyraAccoladeDefinitionRow Row;
25
+
26
+ UPROPERTY(BlueprintReadOnly)
27
+ TObjectPtr<USoundBase> Sound = nullptr;
28
+
29
+ UPROPERTY(BlueprintReadOnly)
30
+ TObjectPtr<UObject> Icon = nullptr;
31
+
32
+ UPROPERTY()
33
+ TObjectPtr<UUserWidget> AllocatedWidget = nullptr;
34
+
35
+ int32 SequenceID = 0;
36
+
37
+ bool bFinishedLoading = false;
38
+
39
+ void CancelDisplay();
40
+ };
41
+
42
+ /**
43
+ *
44
+ */
45
+ UCLASS(BlueprintType)
46
+ class ULyraAccoladeHostWidget : public UCommonUserWidget, public FAsyncMixin
47
+ {
48
+ GENERATED_BODY()
49
+
50
+ public:
51
+ // The location tag (used to filter incoming messages to only display the appropriate accolades in a given location)
52
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
53
+ FGameplayTag LocationName;
54
+
55
+ //~UUserWidget interface
56
+ virtual void NativeConstruct() override;
57
+ virtual void NativeDestruct() override;
58
+ //~End of UUserWidget interface
59
+
60
+ UFUNCTION(BlueprintImplementableEvent)
61
+ void DestroyAccoladeWidget(UUserWidget* Widget);
62
+
63
+ UFUNCTION(BlueprintImplementableEvent)
64
+ UUserWidget* CreateAccoladeWidget(const FPendingAccoladeEntry& Entry);
65
+ private:
66
+ FGameplayMessageListenerHandle ListenerHandle;
67
+
68
+ int32 NextDisplaySequenceID = 0;
69
+ int32 AllocatedSequenceID = 0;
70
+
71
+ FTimerHandle NextTimeToReconsiderHandle;
72
+
73
+ // List of async pending load accolades (which might come in the wrong order due to the row read)
74
+ UPROPERTY(Transient)
75
+ TArray<FPendingAccoladeEntry> PendingAccoladeLoads;
76
+
77
+ // List of pending accolades (due to one at a time display duration; the first one in the list is the current visible one)
78
+ UPROPERTY(Transient)
79
+ TArray<FPendingAccoladeEntry> PendingAccoladeDisplays;
80
+
81
+
82
+ void OnNotificationMessage(FGameplayTag Channel, const FLyraNotificationMessage& Notification);
83
+ void OnRegistryLoadCompleted(const FDataRegistryAcquireResult& AccoladeHandle, int32 SequenceID);
84
+
85
+ void ConsiderLoadedAccolades();
86
+ void PopDisplayedAccolade();
87
+ void ProcessLoadedAccolade(const FPendingAccoladeEntry& Entry);
88
+ void DisplayNextAccolade();
89
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Input/AimAssistInputModifier.h ADDED
@@ -0,0 +1,407 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "GameplayTagContainer.h"
6
+ #include "Math/IntRect.h"
7
+ #include "ScalableFloat.h"
8
+ #include "WorldCollision.h"
9
+ #include "Input/LyraInputModifiers.h"
10
+ #include "DrawDebugHelpers.h"
11
+ #include "AimAssistInputModifier.generated.h"
12
+
13
+ class APlayerController;
14
+ class UInputAction;
15
+ class ULocalPlayer;
16
+ class UShapeComponent;
17
+ class ULyraAimSensitivityData;
18
+ class ULyraSettingsShared;
19
+
20
+ DECLARE_LOG_CATEGORY_EXTERN(LogAimAssist, Log, All);
21
+
22
+ /** A container for some commonly used viewport data based on the current pawn */
23
+ struct FAimAssistOwnerViewData
24
+ {
25
+ FAimAssistOwnerViewData() { ResetViewData(); }
26
+
27
+ /**
28
+ * Update the "owner" information based on our current player controller. This calculates and stores things like the view matrix
29
+ * and current rotation that is used to determine what targets are visible
30
+ */
31
+ void UpdateViewData(const APlayerController* PC);
32
+
33
+ /** Reset all the properties on this set of data to their defaults */
34
+ void ResetViewData();
35
+
36
+ /** Returns true if this owner struct has a valid player controller */
37
+ bool IsDataValid() const { return PlayerController != nullptr && LocalPlayer != nullptr; }
38
+
39
+ FBox2D ProjectReticleToScreen(float ReticleWidth, float ReticleHeight, float ReticleDepth) const;
40
+ FBox2D ProjectBoundsToScreen(const FBox& Bounds) const;
41
+ FBox2D ProjectShapeToScreen(const FCollisionShape& Shape, const FVector& ShapeOrigin, const FTransform& WorldTransform) const;
42
+ FBox2D ProjectBoxToScreen(const FCollisionShape& Shape, const FVector& ShapeOrigin, const FTransform& WorldTransform) const;
43
+ FBox2D ProjectSphereToScreen(const FCollisionShape& Shape, const FVector& ShapeOrigin, const FTransform& WorldTransform) const;
44
+ FBox2D ProjectCapsuleToScreen(const FCollisionShape& Shape, const FVector& ShapeOrigin, const FTransform& WorldTransform) const;
45
+
46
+ /** Pointer to the player controller that can be used to calculate the data we need to check for visible targets */
47
+ const APlayerController* PlayerController = nullptr;
48
+
49
+ const ULocalPlayer* LocalPlayer = nullptr;
50
+
51
+ FMatrix ProjectionMatrix = FMatrix::Identity;
52
+
53
+ FMatrix ViewProjectionMatrix = FMatrix::Identity;
54
+
55
+ FIntRect ViewRect = FIntRect(0, 0, 0, 0);
56
+
57
+ FTransform ViewTransform = FTransform::Identity;
58
+
59
+ FVector ViewForward = FVector::ZeroVector;
60
+
61
+ // Player transform is the actor's location and the controller's rotation.
62
+ FTransform PlayerTransform = FTransform::Identity;
63
+
64
+ FTransform PlayerInverseTransform = FTransform::Identity;
65
+
66
+ /** The movement delta between the current frame and the last */
67
+ FVector DeltaMovement = FVector::ZeroVector;
68
+
69
+ /** The ID of the team that this owner is from. It is populated from the ALyraPlayerState. If the owner does not have a player state, then it will be INDEX_NONE */
70
+ int32 TeamID = INDEX_NONE;
71
+ };
72
+
73
+ /** A container for keeping the state of targets between frames that can be cached */
74
+ USTRUCT(BlueprintType)
75
+ struct FLyraAimAssistTarget
76
+ {
77
+ GENERATED_BODY()
78
+
79
+ FLyraAimAssistTarget() { ResetTarget(); }
80
+
81
+ bool IsTargetValid() const { return TargetShapeComponent.IsValid(); }
82
+
83
+ void ResetTarget();
84
+
85
+ FRotator GetRotationFromMovement(const FAimAssistOwnerViewData& OwnerInfo) const;
86
+
87
+ TWeakObjectPtr<UShapeComponent> TargetShapeComponent;
88
+
89
+ FVector Location = FVector::ZeroVector;
90
+ FVector DeltaMovement = FVector::ZeroVector;
91
+ FBox2D ScreenBounds;
92
+
93
+ float ViewDistance = 0.0f;
94
+ float SortScore = 0.0f;
95
+
96
+ float AssistTime = 0.0f;
97
+ float AssistWeight = 0.0f;
98
+
99
+ FTraceHandle VisibilityTraceHandle;
100
+
101
+ uint8 bIsVisible : 1;
102
+
103
+ uint8 bUnderAssistInnerReticle : 1;
104
+
105
+ uint8 bUnderAssistOuterReticle : 1;
106
+
107
+ protected:
108
+
109
+ float CalculateRotationToTarget2D(float TargetX, float TargetY, float OffsetY) const;
110
+ };
111
+
112
+ /** Options for filtering out certain aim assist targets */
113
+ USTRUCT(BlueprintType)
114
+ struct FAimAssistFilter
115
+ {
116
+ GENERATED_BODY()
117
+
118
+ FAimAssistFilter()
119
+ : bIncludeSameFriendlyTargets(false)
120
+ , bExcludeInstigator(true)
121
+ , bExcludeAllAttachedToInstigator(false)
122
+ , bExcludeRequester(true)
123
+ , bExcludeAllAttachedToRequester(false)
124
+ , bTraceComplexCollision(false)
125
+ , bExcludeDeadOrDying(true)
126
+ {}
127
+
128
+ /** If true, then we should include any targets even if they are on our team */
129
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
130
+ uint8 bIncludeSameFriendlyTargets : 1;
131
+
132
+ /** Exclude 'RequestedBy->Instigator' Actor */
133
+ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = TargetSelection)
134
+ uint8 bExcludeInstigator : 1;
135
+
136
+ /** Exclude all actors attached to 'RequestedBy->Instigator' Actor */
137
+ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = TargetSelection)
138
+ uint32 bExcludeAllAttachedToInstigator : 1;
139
+
140
+ /** Exclude 'RequestedBy Actor */
141
+ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = TargetSelection)
142
+ uint8 bExcludeRequester : 1;
143
+
144
+ /** Exclude all actors attached to 'RequestedBy Actor */
145
+ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = TargetSelection)
146
+ uint8 bExcludeAllAttachedToRequester : 1;
147
+
148
+ /** Trace against complex collision. */
149
+ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = TargetSelection)
150
+ uint8 bTraceComplexCollision : 1;
151
+
152
+ /** Exclude all dead or dying targets */
153
+ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = TargetSelection)
154
+ uint8 bExcludeDeadOrDying : 1;
155
+
156
+ /** Any target whose owning actor is of this type will be excluded. */
157
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
158
+ TSet<TObjectPtr<UClass>> ExcludedClasses;
159
+
160
+ /** Targets with any of these tags will be excluded. */
161
+ FGameplayTagContainer ExclusionGameplayTags;
162
+
163
+ /** Any target outside of this range will be excluded */
164
+ UPROPERTY(EditAnywhere, BlueprintReadOnly)
165
+ double TargetRange = 10000.0;
166
+ };
167
+
168
+ /** Settings for how aim assist should behave when there are active targets */
169
+ USTRUCT(BlueprintType)
170
+ struct FAimAssistSettings
171
+ {
172
+ GENERATED_BODY()
173
+
174
+ FAimAssistSettings();
175
+
176
+ float GetTargetWeightForTime(float Time) const;
177
+ float GetTargetWeightMaxTime() const;
178
+
179
+ // Width of aim assist inner reticle in world space.
180
+ UPROPERTY(EditAnywhere)
181
+ FScalableFloat AssistInnerReticleWidth;
182
+
183
+ // Height of aim assist inner reticle in world space.
184
+ UPROPERTY(EditAnywhere)
185
+ FScalableFloat AssistInnerReticleHeight;
186
+
187
+ // Width of aim assist outer reticle in world space.
188
+ UPROPERTY(EditAnywhere)
189
+ FScalableFloat AssistOuterReticleWidth;
190
+
191
+ // Height of aim assist outer reticle in world space.
192
+ UPROPERTY(EditAnywhere)
193
+ FScalableFloat AssistOuterReticleHeight;
194
+
195
+ // Width of targeting reticle in world space.
196
+ UPROPERTY(EditAnywhere)
197
+ FScalableFloat TargetingReticleWidth;
198
+
199
+ // Height of targeting reticle in world space.
200
+ UPROPERTY(EditAnywhere)
201
+ FScalableFloat TargetingReticleHeight;
202
+
203
+ // Range from player's camera used to gather potential targets.
204
+ // Note: This is scaled using the field of view in order to limit targets by their screen size.
205
+ UPROPERTY(EditAnywhere)
206
+ FScalableFloat TargetRange;
207
+
208
+ // How much weight the target has based on the time it has been targeted. (0 = None, 1 = Max)
209
+ UPROPERTY(EditAnywhere)
210
+ TObjectPtr<const UCurveFloat> TargetWeightCurve = nullptr;
211
+
212
+ // How much target and player movement contributes to the aim assist pull when target is under the inner reticle. (0 = None, 1 = Max)
213
+ UPROPERTY(EditAnywhere)
214
+ FScalableFloat PullInnerStrengthHip;
215
+
216
+ // How much target and player movement contributes to the aim assist pull when target is under the outer reticle. (0 = None, 1 = Max)
217
+ UPROPERTY(EditAnywhere)
218
+ FScalableFloat PullOuterStrengthHip;
219
+
220
+ // How much target and player movement contributes to the aim assist pull when target is under the inner reticle. (0 = None, 1 = Max)
221
+ UPROPERTY(EditAnywhere)
222
+ FScalableFloat PullInnerStrengthAds;
223
+
224
+ // How much target and player movement contributes to the aim assist pull when target is under the outer reticle. (0 = None, 1 = Max)
225
+ UPROPERTY(EditAnywhere)
226
+ FScalableFloat PullOuterStrengthAds;
227
+
228
+ // Exponential interpolation rate used to ramp up the pull strength. Set to '0' to disable.
229
+ UPROPERTY(EditAnywhere)
230
+ FScalableFloat PullLerpInRate;
231
+
232
+ // Exponential interpolation rate used to ramp down the pull strength. Set to '0' to disable.
233
+ UPROPERTY(EditAnywhere)
234
+ FScalableFloat PullLerpOutRate;
235
+
236
+ // Rotation rate maximum cap on amount of aim assist pull. Set to '0' to disable.
237
+ // Note: This is scaled based on the field of view so it feels the same regardless of zoom.
238
+ UPROPERTY(EditAnywhere)
239
+ FScalableFloat PullMaxRotationRate;
240
+
241
+ // Amount of aim assist slow applied to desired turn rate when target is under the inner reticle. (0 = None, 1 = Max)
242
+ UPROPERTY(EditAnywhere)
243
+ FScalableFloat SlowInnerStrengthHip;
244
+
245
+ // Amount of aim assist slow applied to desired turn rate when target is under the outer reticle. (0 = None, 1 = Max)
246
+ UPROPERTY(EditAnywhere)
247
+ FScalableFloat SlowOuterStrengthHip;
248
+
249
+ // Amount of aim assist slow applied to desired turn rate when target is under the inner reticle. (0 = None, 1 = Max)
250
+ UPROPERTY(EditAnywhere)
251
+ FScalableFloat SlowInnerStrengthAds;
252
+
253
+ // Amount of aim assist slow applied to desired turn rate when target is under the outer reticle. (0 = None, 1 = Max)
254
+ UPROPERTY(EditAnywhere)
255
+ FScalableFloat SlowOuterStrengthAds;
256
+
257
+ // Exponential interpolation rate used to ramp up the slow strength. Set to '0' to disable.
258
+ UPROPERTY(EditAnywhere)
259
+ FScalableFloat SlowLerpInRate;
260
+
261
+ // Exponential interpolation rate used to ramp down the slow strength. Set to '0' to disable.
262
+ UPROPERTY(EditAnywhere)
263
+ FScalableFloat SlowLerpOutRate;
264
+
265
+ // Rotation rate minimum cap on amount to aim assist slow. Set to '0' to disable.
266
+ // Note: This is scaled based on the field of view so it feels the same regardless of zoom.
267
+ UPROPERTY(EditAnywhere)
268
+ FScalableFloat SlowMinRotationRate;
269
+
270
+ /** The maximum number of targets that can be considered during a given frame. */
271
+ UPROPERTY(EditAnywhere)
272
+ int32 MaxNumberOfTargets = 6;
273
+
274
+ /** */
275
+ UPROPERTY(EditAnywhere)
276
+ float ReticleDepth = 3000.0f;
277
+
278
+ UPROPERTY(EditAnywhere)
279
+ float TargetScore_AssistWeight = 10.0f;
280
+
281
+ UPROPERTY(EditAnywhere)
282
+ float TargetScore_ViewDot = 50.0f;
283
+
284
+ UPROPERTY(EditAnywhere)
285
+ float TargetScore_ViewDotOffset = 40.0f;
286
+
287
+ UPROPERTY(EditAnywhere)
288
+ float TargetScore_ViewDistance = 0.25f;
289
+
290
+ UPROPERTY(EditAnywhere)
291
+ float StrengthScale = 1.0f;
292
+
293
+ /** Enabled/Disable asynchronous visibility traces. */
294
+ UPROPERTY(EditAnywhere)
295
+ uint8 bEnableAsyncVisibilityTrace : 1;
296
+
297
+ /** Whether or not we require input for aim assist to be applied */
298
+ UPROPERTY(EditAnywhere)
299
+ uint8 bRequireInput : 1;
300
+
301
+ /** Whether or not pull should be applied to aim assist */
302
+ UPROPERTY(EditAnywhere)
303
+ uint8 bApplyPull : 1;
304
+
305
+ /** Whether or not to apply a strafe pull based off of movement input */
306
+ UPROPERTY(EditAnywhere)
307
+ uint8 bApplyStrafePullScale : 1;
308
+
309
+ /** Whether or not to apply a slowing effect during aim assist */
310
+ UPROPERTY(EditAnywhere)
311
+ uint8 bApplySlowing : 1;
312
+
313
+ /** Whether or not to apply a dynamic slow effect based off of look input */
314
+ UPROPERTY(EditAnywhere)
315
+ uint8 bUseDynamicSlow : 1;
316
+
317
+ /** Whether or not look rates should blend between yaw and pitch based on stick deflection using radial look rates */
318
+ UPROPERTY(EditAnywhere)
319
+ uint8 bUseRadialLookRates : 1;
320
+ };
321
+
322
+ /**
323
+ * An input modifier to help gamepad players have better targeting.
324
+ */
325
+ UCLASS()
326
+ class UAimAssistInputModifier : public UInputModifier
327
+ {
328
+ GENERATED_BODY()
329
+
330
+ public:
331
+
332
+ UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Category=Settings, Config)
333
+ FAimAssistSettings Settings {};
334
+
335
+ UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Category=Settings, Config)
336
+ FAimAssistFilter Filter {};
337
+
338
+ /** The input action that represents the actual movement of the player */
339
+ UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Category=Settings)
340
+ TObjectPtr<const UInputAction> MoveInputAction = nullptr;
341
+
342
+ /** The type of targeting to use for this Sensitivity */
343
+ UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Category=Settings, Config)
344
+ ELyraTargetingType TargetingType = ELyraTargetingType::Normal;
345
+
346
+ /** Asset that gives us access to the float scalar value being used for sensitivty */
347
+ UPROPERTY(EditAnywhere, BlueprintReadOnly, meta=(AssetBundles="Client,Server"))
348
+ TObjectPtr<const ULyraAimSensitivityData> SensitivityLevelTable = nullptr;
349
+
350
+ protected:
351
+
352
+ virtual FInputActionValue ModifyRaw_Implementation(const UEnhancedPlayerInput* PlayerInput, FInputActionValue CurrentValue, float DeltaTime) override;
353
+
354
+ /**
355
+ * Swaps the target cache's and determines what targets are currently visible.
356
+ * Updates the score of each target to determine
357
+ * how much pull/slow effect should be applied to each
358
+ */
359
+ void UpdateTargetData(float DeltaTime);
360
+
361
+ FRotator UpdateRotationalVelocity(APlayerController* PC, float DeltaTime, FVector CurrentLookInputValue, FVector CurrentMoveInputValue);
362
+
363
+ /** Calcualte the pull and slow strengh of a given target */
364
+ void CalculateTargetStrengths(const FLyraAimAssistTarget& Target, float& OutPullStrength, float& OutSlowStrength) const;
365
+
366
+ FRotator GetLookRates(const FVector& LookInput);
367
+
368
+ void SwapTargetCaches() { TargetCacheIndex ^= 1; }
369
+ const TArray<FLyraAimAssistTarget>& GetPreviousTargetCache() const { return ((TargetCacheIndex == 0) ? TargetCache1 : TargetCache0); }
370
+ TArray<FLyraAimAssistTarget>& GetPreviousTargetCache() { return ((TargetCacheIndex == 0) ? TargetCache1 : TargetCache0); }
371
+
372
+ const TArray<FLyraAimAssistTarget>& GetCurrentTargetCache() const { return ((TargetCacheIndex == 0) ? TargetCache0 : TargetCache1); }
373
+ TArray<FLyraAimAssistTarget>& GetCurrentTargetCache() { return ((TargetCacheIndex == 0) ? TargetCache0 : TargetCache1); }
374
+
375
+ bool HasAnyCurrentTargets() const { return !GetCurrentTargetCache().IsEmpty(); }
376
+
377
+ const float GetSensitivtyScalar(const ULyraSettingsShared* SharedSettings) const;
378
+
379
+ // Tracking of the current and previous frame's targets
380
+ UPROPERTY()
381
+ TArray<FLyraAimAssistTarget> TargetCache0;
382
+
383
+ UPROPERTY()
384
+ TArray<FLyraAimAssistTarget> TargetCache1;
385
+
386
+ /** The current in use target cache */
387
+ uint32 TargetCacheIndex;
388
+
389
+ FAimAssistOwnerViewData OwnerViewData;
390
+
391
+ float LastPullStrength = 0.0f;
392
+ float LastSlowStrength = 0.0f;
393
+
394
+ #if ENABLE_DRAW_DEBUG
395
+ float LastLookRateYaw;
396
+ float LastLookRatePitch;
397
+
398
+ FVector LastOutValue;
399
+ FVector LastBaselineValue;
400
+
401
+ // TODO: Remove this variable and move debug visualization out of this
402
+ bool bRegisteredDebug = false;
403
+
404
+ void AimAssistDebugDraw(class UCanvas* Canvas, APlayerController* PC);
405
+ FDelegateHandle DebugDrawHandle;
406
+ #endif
407
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Input/AimAssistTargetComponent.h ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Components/CapsuleComponent.h"
6
+ #include "GameplayTagContainer.h"
7
+ #include "IAimAssistTargetInterface.h"
8
+
9
+ #include "AimAssistTargetComponent.generated.h"
10
+
11
+ #define UE_API SHOOTERCORERUNTIME_API
12
+
13
+ class UObject;
14
+
15
+ /**
16
+ * This component can be added to any actor to have it register with the Aim Assist Target Manager.
17
+ */
18
+ UCLASS(MinimalAPI, BlueprintType, meta=(BlueprintSpawnableComponent))
19
+ class UAimAssistTargetComponent : public UCapsuleComponent, public IAimAssistTaget
20
+ {
21
+ GENERATED_BODY()
22
+
23
+ public:
24
+
25
+ //~ Begin IAimAssistTaget interface
26
+ UE_API virtual void GatherTargetOptions(OUT FAimAssistTargetOptions& TargetData) override;
27
+ //~ End IAimAssistTaget interface
28
+
29
+ protected:
30
+
31
+ UPROPERTY(BlueprintReadWrite, EditAnywhere)
32
+ FAimAssistTargetOptions TargetData {};
33
+ };
34
+
35
+ #undef UE_API
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Input/AimAssistTargetManagerComponent.h ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Components/GameStateComponent.h"
6
+
7
+ #include "AimAssistTargetManagerComponent.generated.h"
8
+
9
+ #define UE_API SHOOTERCORERUNTIME_API
10
+
11
+ enum class ECommonInputType : uint8;
12
+
13
+ class APlayerController;
14
+ class UObject;
15
+ struct FAimAssistFilter;
16
+ struct FAimAssistOwnerViewData;
17
+ struct FAimAssistSettings;
18
+ struct FAimAssistTargetOptions;
19
+ struct FCollisionQueryParams;
20
+ struct FLyraAimAssistTarget;
21
+
22
+ /**
23
+ * The Aim Assist Target Manager Component is used to gather all aim assist targets that are within
24
+ * a given player's view. Targets must implement the IAimAssistTargetInterface and be on the
25
+ * collision channel that is set in the ShooterCoreRuntimeSettings.
26
+ */
27
+ UCLASS(MinimalAPI, Blueprintable)
28
+ class UAimAssistTargetManagerComponent : public UGameStateComponent
29
+ {
30
+ GENERATED_BODY()
31
+
32
+ public:
33
+
34
+ /** Gets all visible active targets based on the given local player and their ViewTransform */
35
+ UE_API void GetVisibleTargets(const FAimAssistFilter& Filter, const FAimAssistSettings& Settings, const FAimAssistOwnerViewData& OwnerData, const TArray<FLyraAimAssistTarget>& OldTargets, OUT TArray<FLyraAimAssistTarget>& OutNewTargets);
36
+
37
+ /** Get a Player Controller's FOV scaled based on their current input type. */
38
+ static UE_API float GetFOVScale(const APlayerController* PC, ECommonInputType InputType);
39
+
40
+ /** Get the collision channel that should be used to find targets within the player's view. */
41
+ UE_API ECollisionChannel GetAimAssistChannel() const;
42
+
43
+ protected:
44
+
45
+ /**
46
+ * Returns true if the given target passes the filter based on the current player owner data.
47
+ * False if the given target should be excluded from aim assist calculations
48
+ */
49
+ UE_API bool DoesTargetPassFilter(const FAimAssistOwnerViewData& OwnerData, const FAimAssistFilter& Filter, const FAimAssistTargetOptions& Target, const float AcceptableRange) const;
50
+
51
+ /** Determine if the given target is visible based on our current view data. */
52
+ UE_API void DetermineTargetVisibility(FLyraAimAssistTarget& Target, const FAimAssistSettings& Settings, const FAimAssistFilter& Filter, const FAimAssistOwnerViewData& OwnerData);
53
+
54
+ /** Setup CollisionQueryParams to ignore a set of actors based on filter settings. Such as Ignoring Requester or Instigator. */
55
+ UE_API void InitTargetSelectionCollisionParams(FCollisionQueryParams& OutParams, const AActor& RequestedBy, const FAimAssistFilter& Filter) const;
56
+ };
57
+
58
+ #undef UE_API
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Input/IAimAssistTargetInterface.h ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "CoreMinimal.h"
6
+ #include "Input/AimAssistInputModifier.h"
7
+ #include "UObject/Interface.h"
8
+ #include "IAimAssistTargetInterface.generated.h"
9
+
10
+ USTRUCT(BlueprintType)
11
+ struct FAimAssistTargetOptions
12
+ {
13
+ GENERATED_BODY()
14
+
15
+ FAimAssistTargetOptions()
16
+ : bIsActive(true)
17
+ {}
18
+
19
+ /** The shape component that should be used when considering this target's hitbox */
20
+ TWeakObjectPtr<UShapeComponent> TargetShapeComponent;
21
+
22
+ /**
23
+ * Gameplay tags that are associated with this target that can be used to filter it out.
24
+ *
25
+ * If the player's aim assist settings have any tags that match these, it will be excluded.
26
+ */
27
+ UPROPERTY(BlueprintReadWrite, EditAnywhere)
28
+ FGameplayTagContainer AssociatedTags;
29
+
30
+ /** Whether or not this target is currently active. If false, it will not be considered for aim assist */
31
+ UPROPERTY(BlueprintReadWrite, EditAnywhere)
32
+ uint8 bIsActive : 1;
33
+ };
34
+
35
+
36
+ UINTERFACE(MinimalAPI, meta = (CannotImplementInterfaceInBlueprint))
37
+ class UAimAssistTaget : public UInterface
38
+ {
39
+ GENERATED_BODY()
40
+ };
41
+
42
+ /**
43
+ * Used to define the shape of an aim assist target as well as let the aim assist manager know
44
+ * about any associated gameplay tags.
45
+ *
46
+ * The target will be considered when it is within the view of a player's outer reticle
47
+ *
48
+ * @see UAimAssistTargetComponent for an example
49
+ */
50
+ class IAimAssistTaget
51
+ {
52
+ GENERATED_BODY()
53
+
54
+ public:
55
+ /** Populate the given target data with this interface. This will be called when a target is within view of the player */
56
+ virtual void GatherTargetOptions(OUT FAimAssistTargetOptions& TargetData) = 0;
57
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/LyraWorldCollectable.h ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "GameFramework/Actor.h"
6
+ #include "Interaction/IInteractableTarget.h"
7
+ #include "Interaction/InteractionOption.h"
8
+ #include "Inventory/IPickupable.h"
9
+
10
+ #include "LyraWorldCollectable.generated.h"
11
+
12
+ class UObject;
13
+ struct FInteractionQuery;
14
+
15
+ /**
16
+ *
17
+ */
18
+ UCLASS(Abstract, Blueprintable)
19
+ class ALyraWorldCollectable : public AActor, public IInteractableTarget, public IPickupable
20
+ {
21
+ GENERATED_BODY()
22
+
23
+ public:
24
+
25
+ ALyraWorldCollectable();
26
+
27
+ virtual void GatherInteractionOptions(const FInteractionQuery& InteractQuery, FInteractionOptionBuilder& InteractionBuilder) override;
28
+ virtual FInventoryPickup GetPickupInventory() const override;
29
+
30
+ protected:
31
+ UPROPERTY(EditAnywhere)
32
+ FInteractionOption Option;
33
+
34
+ UPROPERTY(EditAnywhere)
35
+ FInventoryPickup StaticInventory;
36
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/MessageProcessors/AssistProcessor.h ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Messages/GameplayMessageProcessor.h"
6
+
7
+ #include "AssistProcessor.generated.h"
8
+
9
+ class APlayerState;
10
+ class UObject;
11
+ struct FGameplayTag;
12
+ struct FLyraVerbMessage;
13
+ template <typename T> struct TObjectPtr;
14
+
15
+ // Tracks the damage done to a player by other players
16
+ USTRUCT()
17
+ struct FPlayerAssistDamageTracking
18
+ {
19
+ GENERATED_BODY()
20
+
21
+ // Map of damager to damage dealt
22
+ UPROPERTY(Transient)
23
+ TMap<TObjectPtr<APlayerState>, float> AccumulatedDamageByPlayer;
24
+ };
25
+
26
+ // Tracks assists (dealing damage to another player without finishing them)
27
+ UCLASS()
28
+ class UAssistProcessor : public UGameplayMessageProcessor
29
+ {
30
+ GENERATED_BODY()
31
+
32
+ public:
33
+ virtual void StartListening() override;
34
+
35
+ private:
36
+ void OnDamageMessage(FGameplayTag Channel, const FLyraVerbMessage& Payload);
37
+ void OnEliminationMessage(FGameplayTag Channel, const FLyraVerbMessage& Payload);
38
+
39
+ private:
40
+ // Map of player to damage dealt to them
41
+ UPROPERTY(Transient)
42
+ TMap<TObjectPtr<APlayerState>, FPlayerAssistDamageTracking> DamageHistory;
43
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/MessageProcessors/ElimChainProcessor.h ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Messages/GameplayMessageProcessor.h"
6
+
7
+ #include "ElimChainProcessor.generated.h"
8
+
9
+ class APlayerState;
10
+ class UObject;
11
+ struct FGameplayTag;
12
+ struct FLyraVerbMessage;
13
+ template <typename T> struct TObjectPtr;
14
+
15
+ USTRUCT()
16
+ struct FPlayerElimChainInfo
17
+ {
18
+ GENERATED_BODY()
19
+
20
+ double LastEliminationTime = 0.0;
21
+
22
+ int32 ChainCounter = 1;
23
+ };
24
+
25
+ // Tracks a chain of eliminations (X eliminations without more than Y seconds passing between each one)
26
+ UCLASS(Abstract)
27
+ class UElimChainProcessor : public UGameplayMessageProcessor
28
+ {
29
+ GENERATED_BODY()
30
+
31
+ public:
32
+ virtual void StartListening() override;
33
+
34
+ protected:
35
+ UPROPERTY(EditDefaultsOnly)
36
+ float ChainTimeLimit = 4.5f;
37
+
38
+ // The event to rebroadcast when a user gets a chain of a certain length
39
+ UPROPERTY(EditDefaultsOnly)
40
+ TMap<int32, FGameplayTag> ElimChainTags;
41
+
42
+ private:
43
+ void OnEliminationMessage(FGameplayTag Channel, const FLyraVerbMessage& Payload);
44
+
45
+ private:
46
+ UPROPERTY(Transient)
47
+ TMap<TObjectPtr<APlayerState>, FPlayerElimChainInfo> PlayerChainHistory;
48
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/MessageProcessors/ElimStreakProcessor.h ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Messages/GameplayMessageProcessor.h"
6
+
7
+ #include "ElimStreakProcessor.generated.h"
8
+
9
+ class APlayerState;
10
+ class UObject;
11
+ struct FGameplayTag;
12
+ struct FLyraVerbMessage;
13
+ template <typename T> struct TObjectPtr;
14
+
15
+ // Tracks a streak of eliminations (X eliminations without being eliminated)
16
+ UCLASS(Abstract)
17
+ class UElimStreakProcessor : public UGameplayMessageProcessor
18
+ {
19
+ GENERATED_BODY()
20
+
21
+ public:
22
+ virtual void StartListening() override;
23
+
24
+ protected:
25
+ // The event to rebroadcast when a user gets a streak of a certain length
26
+ UPROPERTY(EditDefaultsOnly)
27
+ TMap<int32, FGameplayTag> ElimStreakTags;
28
+
29
+ private:
30
+ void OnEliminationMessage(FGameplayTag Channel, const FLyraVerbMessage& Payload);
31
+
32
+ private:
33
+ UPROPERTY(Transient)
34
+ TMap<TObjectPtr<APlayerState>, int32> PlayerStreakHistory;
35
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/Messages/ControlPointStatusMessage.h ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "CoreMinimal.h"
6
+
7
+ #include "ControlPointStatusMessage.generated.h"
8
+
9
+ // Message indicating the state of a control point is changing
10
+ USTRUCT(BlueprintType)
11
+ struct FLyraControlPointStatusMessage
12
+ {
13
+ GENERATED_BODY()
14
+
15
+ UPROPERTY(BlueprintReadWrite, Category=Gameplay)
16
+ TObjectPtr<AActor> ControlPoint = nullptr;
17
+
18
+ UPROPERTY(BlueprintReadWrite, Category=Gameplay)
19
+ int32 OwnerTeamID = 0;
20
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/ShooterCoreRuntimeModule.h ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Modules/ModuleInterface.h"
6
+
7
+ class UShooterCoreRuntimeSettings;
8
+
9
+ class FShooterCoreRuntimeModule : public IModuleInterface
10
+ {
11
+ public:
12
+
13
+ /** IModuleInterface implementation */
14
+ virtual void StartupModule() override;
15
+ virtual void ShutdownModule() override;
16
+
17
+ protected:
18
+
19
+ UShooterCoreRuntimeSettings* ShooterCoreSettings = nullptr;
20
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/Public/ShooterCoreRuntimeSettings.h ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ #pragma once
4
+
5
+ #include "Engine/DeveloperSettings.h"
6
+ #include "Engine/EngineTypes.h"
7
+
8
+ #include "ShooterCoreRuntimeSettings.generated.h"
9
+
10
+ class UObject;
11
+
12
+ /** Runtime settings specific to the ShooterCoreRuntime plugin */
13
+ UCLASS(config = Game, defaultconfig)
14
+ class UShooterCoreRuntimeSettings : public UDeveloperSettings
15
+ {
16
+ GENERATED_BODY()
17
+
18
+ public:
19
+ UShooterCoreRuntimeSettings(const FObjectInitializer& Initializer);
20
+
21
+ ECollisionChannel GetAimAssistCollisionChannel() const { return AimAssistCollisionChannel; }
22
+
23
+ private:
24
+
25
+ /**
26
+ * What trace channel should be used to find available targets for Aim Assist.
27
+ * @see UAimAssistTargetManagerComponent::GetVisibleTargets
28
+ */
29
+ UPROPERTY(config, EditAnywhere, Category = "Aim Assist")
30
+ TEnumAsByte<ECollisionChannel> AimAssistCollisionChannel = ECollisionChannel::ECC_EngineTraceChannel5;
31
+ };
LyraStarterGame/Plugins/GameFeatures/ShooterCore/Source/ShooterCoreRuntime/ShooterCoreRuntime.Build.cs ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright Epic Games, Inc. All Rights Reserved.
2
+
3
+ using UnrealBuildTool;
4
+
5
+ public class ShooterCoreRuntime : ModuleRules
6
+ {
7
+ public ShooterCoreRuntime(ReadOnlyTargetRules Target) : base(Target)
8
+ {
9
+ PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
10
+
11
+ PublicIncludePaths.AddRange(
12
+ new string[] {
13
+ // ... add public include paths required here ...
14
+ }
15
+ );
16
+
17
+
18
+ PrivateIncludePaths.AddRange(
19
+ new string[] {
20
+ // ... add other private include paths required here ...
21
+ }
22
+ );
23
+
24
+
25
+ PublicDependencyModuleNames.AddRange(
26
+ new string[]
27
+ {
28
+ "Core",
29
+ "LyraGame",
30
+ "ModularGameplay",
31
+ "CommonGame",
32
+ // ... add other public dependencies that you statically link with here ...
33
+ }
34
+ );
35
+
36
+
37
+ PrivateDependencyModuleNames.AddRange(
38
+ new string[]
39
+ {
40
+ "CoreUObject",
41
+ "Engine",
42
+ "Slate",
43
+ "SlateCore",
44
+ "GameplayTags",
45
+ "GameplayTasks",
46
+ "GameplayAbilities",
47
+ "GameplayMessageRuntime",
48
+ "CommonUI",
49
+ "UMG",
50
+ "DataRegistry",
51
+ "AsyncMixin",
52
+ "EnhancedInput",
53
+ "GameSubtitles",
54
+ "DeveloperSettings",
55
+ "AIModule"
56
+ // ... add private dependencies that you statically link with here ...
57
+ }
58
+ );
59
+
60
+
61
+ DynamicallyLoadedModuleNames.AddRange(
62
+ new string[]
63
+ {
64
+ // ... add any modules that your module loads dynamically here ...
65
+ }
66
+ );
67
+ }
68
+ }
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Config/Tags/ShooterExplorerTags.ini ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [/Script/GameplayTags.GameplayTagsList]
2
+ GameplayTagList=(Tag="Explorer",DevComment="")
3
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity",DevComment="")
4
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity.Actions",DevComment="")
5
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity.Actions.Emote",DevComment="")
6
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity.Actions.Sit",DevComment="")
7
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity.Actions.Eat",DevComment="")
8
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity.Actions.Sleep",DevComment="")
9
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity.Actions.Sleep.AtNight",DevComment="")
10
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity.Actions.Sleep.DayTime",DevComment="")
11
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity.General",DevComment="")
12
+ GameplayTagList=(Tag="Explorer.SmartObject.Activity.General.Default",DevComment="")
13
+ GameplayTagList=(Tag="Explorer.Mood.Awesome",DevComment="")
14
+ GameplayTagList=(Tag="Explorer.Mood.Angry",DevComment="")
15
+ GameplayTagList=(Tag="Explorer.Mood.Grumpy",DevComment="")
16
+ GameplayTagList=(Tag="Explorer.Mood.Happy",DevComment="")
17
+ GameplayTagList=(Tag="Explorer.Mood.None",DevComment="")
18
+ GameplayTagList=(Tag="Explorer.SmartObject.Event",DevComment="")
19
+ GameplayTagList=(Tag="Explorer.SmartObject.Event.Interaction",DevComment="")
20
+ GameplayTagList=(Tag="Explorer.SmartObject.Event.Interaction.Ended",DevComment="")
21
+ GameplayTagList=(Tag="Explorer.SmartObject.Event.Interaction.Scripted",DevComment="")
22
+ GameplayTagList=(Tag="Explorer.SmartObject.Event.Interaction.Scripted.ToDisable",DevComment="")
23
+ GameplayTagList=(Tag="Explorer.SmartObject.Event.Interaction.Scripted.ToEnable",DevComment="")
24
+ GameplayTagList=(Tag="Explorer.SmartObject.Event.Interaction.Started",DevComment="")
25
+ GameplayTagList=(Tag="Explorer.SmartObject.Event.Interaction.Required",DevComment="")
26
+ GameplayTagList=(Tag="Explorer.SmartObject.Event.Interaction.Required.ToEnable",DevComment="")
27
+ GameplayTagList=(Tag="Explorer.SmartObject.Event.Interaction.Required.ToDisable",DevComment="")
28
+ GameplayTagList=(Tag="Explorer.SmartObject.Interact",DevComment="")
29
+ GameplayTagList=(Tag="Explorer.SmartObject.Interact.NPC",DevComment="")
30
+ GameplayTagList=(Tag="Explorer.SmartObject.Interact.Player",DevComment="")
31
+ GameplayTagList=(Tag="Explorer.SmartObject.Slot",DevComment="")
32
+ GameplayTagList=(Tag="Explorer.SmartObject.Slot.Sync",DevComment="")
33
+ GameplayTagList=(Tag="Explorer.SmartObject.Slot.Sync.Action",DevComment="")
34
+ GameplayTagList=(Tag="Explorer.SmartObject.Slot.Sync.Dependent",DevComment="")
35
+ GameplayTagList=(Tag="Explorer.SmartObject.Slot.Sync.Primary",DevComment="")
36
+ GameplayTagList=(Tag="Explorer.SmartObject.Slot.Sync.Ready",DevComment="")
37
+ GameplayTagList=(Tag="Explorer.SmartObject.Slot.Sync.Stop",DevComment="")
38
+ GameplayTagList=(Tag="Explorer.SmartObject.State",DevComment="")
39
+ GameplayTagList=(Tag="Explorer.SmartObject.State.Broken",DevComment="")
40
+ GameplayTagList=(Tag="Explorer.SmartObject.State.Enabled",DevComment="")
41
+ GameplayTagList=(Tag="Explorer.SmartObject.State.Interaction",DevComment="")
42
+ GameplayTagList=(Tag="Explorer.SmartObject.State.Interaction.Required",DevComment="")
43
+ GameplayTagList=(Tag="Explorer.SmartObject.State.Interaction.Required.ToDisable",DevComment="")
44
+ GameplayTagList=(Tag="Explorer.SmartObject.State.Interaction.Required.ToEnable",DevComment="")
45
+
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Evaluators/EV_PlayerPosition.uasset ADDED
Binary file (24.9 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_Follow.uasset ADDED
Binary file (45.6 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_GetPlayerLocation.uasset ADDED
Binary file (27.3 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_GoTo.uasset ADDED
Binary file (48.2 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_PlayAnimMontage1.uasset ADDED
Binary file (2.81 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/AI/StateTrees/Tasks/STT_SimpleDebugDelays.uasset ADDED
Binary file (82.5 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Blueprint/B_SimpleFollowPawn.uasset ADDED
Binary file (40.1 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Blueprint/B_SimpleFollowPawn_Big.uasset ADDED
Binary file (42.5 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Game/HeroData_Explorer.uasset ADDED
Binary file (2.76 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Input/Abilities/AbilitySet_InventoryTest.uasset ADDED
Binary file (3.48 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Input/Abilities/GA_Interact.uasset ADDED
Binary file (85.5 kB). View file
 
LyraStarterGame/Plugins/GameFeatures/ShooterExplorer/Content/Input/Abilities/GA_ToggleInventory.uasset ADDED
Binary file (6.96 kB). View file