Space Plunder
Loading...
Searching...
No Matches
AALSPlayerController Class Reference

#include <ALSPlayerController.h>

Inheritance diagram for AALSPlayerController:
APlayerControllerBase IPlayerOptions IControllerInterface IPlayerControllerInterface ISaveLoad ACustomPlayerController ACampaignPlayerController

Public Member Functions

virtual void OnPossess (APawn *NewPawn) override
 
virtual void OnRep_Pawn () override
 
virtual void SetupInputComponent () override
 
virtual void BindActions (UInputMappingContext *Context) override
 
- Public Member Functions inherited from APlayerControllerBase
virtual void GetAudioListenerPosition (FVector &OutLocation, FVector &OutFrontDir, FVector &OutRightDir) const override
 
virtual bool SetPlayerLookInverted (const bool bInvert=true) override
 
virtual bool SetPlayerLookHorizontalInverted (const bool bInvert=true) override
 
virtual float SetCameraSensitivity (const float NewValue) override
 
virtual float SetCameraHorizontalSensitivity (const float NewValue) override
 
virtual float SetCameraVerticalSensitivity (const float NewValue) override
 
virtual void SetCameraAimedSensitivityMultiplier (const float NewValue) override
 
virtual void SetCameraUseSeparateAxisSensitivity (const bool bValue) override
 
virtual void SetAimAssistLevel (const int32 Value) override
 
virtual void SetPlayerUsingController (const bool bValue) override
 
virtual bool GetPlayerUsingController () override
 
virtual bool SaveCurrentPlayerOptions (const FAudioPlayerOptions AudioSettings) override
 
virtual float GetCameraSensitivity () const override
 
virtual float GetCameraAimedSensitivityMultiplier () const override
 
virtual float GetCameraHorizontalSensitivity () const override
 
virtual float GetCameraVerticalSensitivity () const override
 
virtual bool GetCameraUseSeparateAxisSensitivity () const override
 
virtual bool GetPlayerLookInverted () const override
 
virtual bool GetPlayerHorizontalInverted () const override
 
virtual int32 GetAimAssistLevel () const override
 
virtual FAudioPlayerOptions GetPlayerAudioSettings () const override
 
virtual bool RegisterLayer (const FGameplayTag LayerName, UUserWidget *LayerWidget) override
 
virtual UUserWidget * PushContentToLayer (const FGameplayTag LayerName, const TSoftClassPtr< UUserWidget > WidgetClass) override
 
virtual bool PopContentFromLayer (const FGameplayTag LayerName) override
 
virtual bool ClearLayer (const FGameplayTag LayerName) override
 
virtual bool ToggleWidget (const FGameplayTag LayerName, UUserWidget *Widget) override
 
virtual UUserWidget * AddWidgetToLayer (const FGameplayTag LayerName, const TSoftClassPtr< UUserWidget > WidgetClass) override
 
virtual UUserWidget * GetContentFromLayer (const FGameplayTag LayerName, const TSoftClassPtr< UUserWidget > WidgetClass) override
 
virtual UUserWidget * AddWidgetToLayerWithSlot (const FGameplayTag LayerName, const FGameplayTag SlotTag, const TSoftClassPtr< UUserWidget > WidgetClass) override
 
virtual void OpenRadialMenu (const FRadialMenuData &Data) override
 
virtual int32 CloseRadialMenu () override
 
virtual bool GetIsRadialMenuOpen () const override
 
virtual void SetCharacterMode (const FGameplayTag &Mode) override
 
virtual FGameplayTag GetCharacterMode () const override
 
virtual void ToggleGameLog () override
 
virtual FVector2D GetLookAxis () const override
 
virtual FVector2D GetMoveAxis () const override
 
virtual FVector2D GetScreenCenter () const override
 
virtual FVector GetPawnLocation () const override
 
virtual void GetControllerViewPoint (FVector &out_Location, FRotator &out_Rotation) const override
 
virtual bool SaveGame () override
 
virtual bool LoadGame () override
 
void OnCharacterModeChanged (const FGameplayTag &Mode)
 

Public Attributes

TObjectPtr< AALSBaseCharacterPossessedCharacter = nullptr
 
TObjectPtr< UInputMappingContext > DefaultInputMappingContext = nullptr
 
TObjectPtr< UInputMappingContext > DebugInputMappingContext = nullptr
 
- Public Attributes inherited from APlayerControllerBase
TObjectPtr< UInputMappingContext > MenuInputMappingContext = nullptr
 
TObjectPtr< UInputMappingContext > MainInputMappingContext = nullptr
 
bool bDebuggingMode = false
 
FName AudioSocket = FName("head")
 

Protected Member Functions

virtual void SetupInputs () override
 
void SetupCamera ()
 
virtual void ForwardMovementAction (const FInputActionValue &Value) override
 
virtual void RightMovementAction (const FInputActionValue &Value) override
 
virtual void CameraUpAction (const FInputActionValue &Value) override
 
virtual void CameraRightAction (const FInputActionValue &Value) override
 
void JumpAction (const FInputActionValue &Value)
 
void SprintAction (const FInputActionValue &Value)
 
virtual void AimAction (const FInputActionValue &Value)
 
void CameraTapAction (const FInputActionValue &Value)
 
void CameraHeldAction (const FInputActionValue &Value)
 
void StanceAction (const FInputActionValue &Value)
 
void WalkAction (const FInputActionValue &Value)
 
void RagdollAction (const FInputActionValue &Value)
 
void VelocityDirectionAction (const FInputActionValue &Value)
 
void LookingDirectionAction (const FInputActionValue &Value)
 
void DebugToggleHudAction (const FInputActionValue &Value)
 
void DebugToggleDebugViewAction (const FInputActionValue &Value)
 
void DebugToggleTracesAction (const FInputActionValue &Value)
 
void DebugToggleShapesAction (const FInputActionValue &Value)
 
void DebugToggleLayerColorsAction (const FInputActionValue &Value)
 
void DebugToggleCharacterInfoAction (const FInputActionValue &Value)
 
void DebugToggleSlomoAction (const FInputActionValue &Value)
 
void DebugFocusedCharacterCycleAction (const FInputActionValue &Value)
 
void DebugToggleMeshAction (const FInputActionValue &Value)
 
void DebugOpenOverlayMenuAction (const FInputActionValue &Value)
 
void DebugOverlayMenuCycleAction (const FInputActionValue &Value)
 
- Protected Member Functions inherited from APlayerControllerBase
virtual void BeginPlay () override
 
virtual void SetupComponents ()
 
virtual bool SavePlayerOptions (const FString &SlotName="Default")
 
virtual bool LoadPlayerOptions (const FString &SlotName="Default")
 
virtual void ApplySettings (const class USettingsSaveGame *LoadedPlayerSettings)
 
virtual USettingsSaveGameApplySettingsToSaveGame (class USettingsSaveGame *LoadedPlayerSettings)
 
virtual void OnPawnSpawn ()
 
virtual void OnPawnSpawnComplete ()
 
virtual float CalculateCameraSensitivity (const float CameraInput) const
 
virtual void MenuConfirmAction (const FInputActionValue &Value)
 
virtual void MenuBackAction (const FInputActionValue &Value)
 
virtual void SelectionUpAction (const FInputActionValue &Value)
 
virtual void CharacterModeAction (const FInputActionValue &Value)
 
IHUDInterfaceGetHUDInterface ()
 
ICharacterBaseInterfaceGetCharacterInterface ()
 
void LogDebugError (const FString &Message) const
 
void LogDebugError (const FString &Message, const int32 Value) const
 
void LogDebugError (const FString &Message, const float Value) const
 
void LogDebugWarning (const FString &Message) const
 
void LogDebugWarning (const FString &Message, const int32 Value) const
 
void LogDebugWarning (const FString &Message, const float Value) const
 
void LogDebugMessage (const FString &Message, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const int32 Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const float Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const bool bValue, const bool bWarning, const bool bError) const
 
void LogOnScreenMessage (const int32 Key, const FString &Message, FColor Color=FColor::Green) const
 
void SetCategoryName (const FLogCategoryBase &Category)
 

Additional Inherited Members

- Protected Attributes inherited from APlayerControllerBase
FGameplayTag CharacterMode = FGameplayTag(CharacterModeTags::Default)
 
int32 MaxPawnSpawnAttempts = 5
 
bool bAimed = false
 

Detailed Description

Player controller class

Member Function Documentation

◆ AimAction()

void AALSPlayerController::AimAction ( const FInputActionValue & Value)
protectedvirtual

Reimplemented in ACustomPlayerController.

177{
179 {
180 PossessedCharacter->AimAction(Value.Get<bool>());
181 }
182}
TObjectPtr< AALSBaseCharacter > PossessedCharacter
Definition ALSPlayerController.h:111

◆ BindActions()

void AALSPlayerController::BindActions ( UInputMappingContext * Context)
overridevirtual

Reimplemented from APlayerControllerBase.

Reimplemented in ACustomPlayerController.

72{
73 Super::BindActions(Context);
74 if (Context)
75 {
76 const TArray<FEnhancedActionKeyMapping>& Mappings = Context->GetMappings();
77 UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(InputComponent);
78 if (EnhancedInputComponent)
79 {
80 // There may be more than one keymapping assigned to one action. So, first filter duplicate action entries to prevent multiple delegate bindings
81 TSet<const UInputAction*> UniqueActions;
82 for (const FEnhancedActionKeyMapping& Keymapping : Mappings)
83 {
84 UniqueActions.Add(Keymapping.Action);
85 }
86 for (const UInputAction* UniqueAction : UniqueActions)
87 {
88 EnhancedInputComponent->BindAction(UniqueAction, ETriggerEvent::Triggered, Cast<UObject>(this), UniqueAction->GetFName());
89 }
90 }
91 }
92}

◆ CameraHeldAction()

void AALSPlayerController::CameraHeldAction ( const FInputActionValue & Value)
protected
193{
195 {
196 PossessedCharacter->CameraHeldAction();
197 }
198}

◆ CameraRightAction()

void AALSPlayerController::CameraRightAction ( const FInputActionValue & Value)
overrideprotectedvirtual

Reimplemented from APlayerControllerBase.

Reimplemented in ACustomPlayerController.

152{
153 Super::CameraRightAction(Value);
155 {
156 PossessedCharacter->CameraRightAction(Value.GetMagnitude());
157 }
158}

◆ CameraTapAction()

void AALSPlayerController::CameraTapAction ( const FInputActionValue & Value)
protected
185{
187 {
188 PossessedCharacter->CameraTapAction();
189 }
190}

◆ CameraUpAction()

void AALSPlayerController::CameraUpAction ( const FInputActionValue & Value)
overrideprotectedvirtual

Reimplemented from APlayerControllerBase.

Reimplemented in ACustomPlayerController.

143{
144 Super::CameraUpAction(Value);
146 {
147 PossessedCharacter->CameraUpAction(Value.GetMagnitude());
148 }
149}

◆ DebugFocusedCharacterCycleAction()

void AALSPlayerController::DebugFocusedCharacterCycleAction ( const FInputActionValue & Value)
protected
325{
327 {
328 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
329 if (DebugComp)
330 {
331 DebugComp->FocusedDebugCharacterCycle(Value.GetMagnitude() > 0);
332 }
333 }
334}
Definition ALSDebugComponent.h:17
void FocusedDebugCharacterCycle(bool bValue)
Definition ALSDebugComponent.cpp:92

◆ DebugOpenOverlayMenuAction()

void AALSPlayerController::DebugOpenOverlayMenuAction ( const FInputActionValue & Value)
protected
349{
351 {
352 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
353 if (DebugComp)
354 {
355 DebugComp->OpenOverlayMenu(Value.Get<bool>());
356 }
357 }
358}
void OpenOverlayMenu(bool bValue)

◆ DebugOverlayMenuCycleAction()

void AALSPlayerController::DebugOverlayMenuCycleAction ( const FInputActionValue & Value)
protected
361{
363 {
364 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
365 if (DebugComp)
366 {
367 DebugComp->OverlayMenuCycle(Value.GetMagnitude() > 0);
368 }
369 }
370}
void OverlayMenuCycle(bool bValue)

◆ DebugToggleCharacterInfoAction()

void AALSPlayerController::DebugToggleCharacterInfoAction ( const FInputActionValue & Value)
protected
301{
302 if (PossessedCharacter && Value.Get<bool>())
303 {
304 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
305 if (DebugComp)
306 {
307 DebugComp->ToggleCharacterInfo();
308 }
309 }
310}
void ToggleCharacterInfo()
Definition ALSDebugComponent.h:80

◆ DebugToggleDebugViewAction()

void AALSPlayerController::DebugToggleDebugViewAction ( const FInputActionValue & Value)
protected
253{
254 if (PossessedCharacter && Value.Get<bool>())
255 {
256 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
257 if (DebugComp)
258 {
259 DebugComp->ToggleDebugView();
260 }
261 }
262}
void ToggleDebugView()
Definition ALSDebugComponent.cpp:194

◆ DebugToggleHudAction()

void AALSPlayerController::DebugToggleHudAction ( const FInputActionValue & Value)
protected
241{
242 if (PossessedCharacter && Value.Get<bool>())
243 {
244 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
245 if (DebugComp)
246 {
247 DebugComp->ToggleHud();
248 }
249 }
250}
void ToggleHud()
Definition ALSDebugComponent.h:56

◆ DebugToggleLayerColorsAction()

void AALSPlayerController::DebugToggleLayerColorsAction ( const FInputActionValue & Value)
protected
289{
290 if (PossessedCharacter && Value.Get<bool>())
291 {
292 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
293 if (DebugComp)
294 {
295 DebugComp->ToggleLayerColors();
296 }
297 }
298}
void ToggleLayerColors()
Definition ALSDebugComponent.h:77

◆ DebugToggleMeshAction()

void AALSPlayerController::DebugToggleMeshAction ( const FInputActionValue & Value)
protected
337{
338 if (PossessedCharacter && Value.Get<bool>())
339 {
340 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
341 if (DebugComp)
342 {
343 DebugComp->ToggleDebugMesh();
344 }
345 }
346}
void ToggleDebugMesh()
Definition ALSDebugComponent.cpp:222

◆ DebugToggleShapesAction()

void AALSPlayerController::DebugToggleShapesAction ( const FInputActionValue & Value)
protected
277{
278 if (PossessedCharacter && Value.Get<bool>())
279 {
280 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
281 if (DebugComp)
282 {
283 DebugComp->ToggleDebugShapes();
284 }
285 }
286}
void ToggleDebugShapes()
Definition ALSDebugComponent.h:74

◆ DebugToggleSlomoAction()

void AALSPlayerController::DebugToggleSlomoAction ( const FInputActionValue & Value)
protected
313{
314 if (PossessedCharacter && Value.Get<bool>())
315 {
316 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
317 if (DebugComp)
318 {
319 DebugComp->ToggleSlomo();
320 }
321 }
322}
void ToggleSlomo()
Definition ALSDebugComponent.cpp:185

◆ DebugToggleTracesAction()

void AALSPlayerController::DebugToggleTracesAction ( const FInputActionValue & Value)
protected
265{
266 if (PossessedCharacter && Value.Get<bool>())
267 {
268 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
269 if (DebugComp)
270 {
271 DebugComp->ToggleTraces();
272 }
273 }
274}
void ToggleTraces()
Definition ALSDebugComponent.h:71

◆ ForwardMovementAction()

void AALSPlayerController::ForwardMovementAction ( const FInputActionValue & Value)
overrideprotectedvirtual

Save Default values to be able to get Controller Input

Reimplemented from APlayerControllerBase.

125{
126 Super::ForwardMovementAction(Value);
128 {
129 PossessedCharacter->ForwardMovementAction(Value.GetMagnitude());
130 }
131}

◆ JumpAction()

void AALSPlayerController::JumpAction ( const FInputActionValue & Value)
protected
161{
163 {
164 PossessedCharacter->JumpAction(Value.Get<bool>());
165 }
166}

◆ LookingDirectionAction()

void AALSPlayerController::LookingDirectionAction ( const FInputActionValue & Value)
protected
233{
234 if (PossessedCharacter && Value.Get<bool>())
235 {
236 PossessedCharacter->LookingDirectionAction();
237 }
238}

◆ OnPossess()

void AALSPlayerController::OnPossess ( APawn * NewPawn)
overridevirtual

Reimplemented from APlayerControllerBase.

Reimplemented in ACustomPlayerController.

18{
19 Super::OnPossess(NewPawn);
20 PossessedCharacter = Cast<AALSBaseCharacter>(NewPawn);
21 if (!IsRunningDedicatedServer())
22 {
23 // Servers want to setup camera only in listen servers.
25 }
26
28
29 if (!IsValid(PossessedCharacter)) return;
30
31 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
32 if (DebugComp)
33 {
34 DebugComp->OnPlayerControllerInitialized(this);
35 }
36}
void SetupCamera()
Definition ALSPlayerController.cpp:114
virtual void SetupInputs() override
Definition ALSPlayerController.cpp:94
void OnPlayerControllerInitialized(APlayerController *Controller)

◆ OnRep_Pawn()

void AALSPlayerController::OnRep_Pawn ( )
overridevirtual

Reimplemented from APlayerControllerBase.

Reimplemented in ACustomPlayerController.

39{
40 Super::OnRep_Pawn();
41 PossessedCharacter = Cast<AALSBaseCharacter>(GetPawn());
44
45 if (!PossessedCharacter) return;
46
47 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
48 if (DebugComp)
49 {
50 DebugComp->OnPlayerControllerInitialized(this);
51 }
52}

◆ RagdollAction()

void AALSPlayerController::RagdollAction ( const FInputActionValue & Value)
protected
217{
218 if (PossessedCharacter && Value.Get<bool>())
219 {
220 PossessedCharacter->RagdollAction();
221 }
222}

◆ RightMovementAction()

void AALSPlayerController::RightMovementAction ( const FInputActionValue & Value)
overrideprotectedvirtual

Reimplemented from APlayerControllerBase.

134{
135 Super::RightMovementAction(Value);
137 {
138 PossessedCharacter->RightMovementAction(Value.GetMagnitude());
139 }
140}

◆ SetupCamera()

void AALSPlayerController::SetupCamera ( )
protected
115{
116 // Call "OnPossess" in Player Camera Manager when possessing a pawn
117 AALSPlayerCameraManager* CastedMgr = Cast<AALSPlayerCameraManager>(PlayerCameraManager);
118 if (PossessedCharacter && CastedMgr)
119 {
120 CastedMgr->OnPossess(PossessedCharacter);
121 }
122}
Definition ALSPlayerCameraManager.h:19
void OnPossess(AALSBaseCharacter *NewCharacter)
Definition ALSPlayerCameraManager.cpp:42

◆ SetupInputComponent()

void AALSPlayerController::SetupInputComponent ( )
overridevirtual

Overridden in Custom Player Controller

Reimplemented from APlayerControllerBase.

Reimplemented in ACustomPlayerController.

55{
56 Super::SetupInputComponent();
58 UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(InputComponent);
59 if(EnhancedInputComponent == nullptr)
60 {
61 UE_LOG(LogTemp, Fatal, TEXT("ALS Community requires Enhanced Input System to be activated in project settings to function properly"));
62 return;
63 }
64 EnhancedInputComponent->ClearActionEventBindings();
65 EnhancedInputComponent->ClearActionValueBindings();
66 EnhancedInputComponent->ClearDebugKeyBindings();
69}
TObjectPtr< UInputMappingContext > DefaultInputMappingContext
Definition ALSPlayerController.h:114
TObjectPtr< UInputMappingContext > DebugInputMappingContext
Definition ALSPlayerController.h:117
virtual void BindActions(UInputMappingContext *Context) override
Definition ALSPlayerController.cpp:71

◆ SetupInputs()

void AALSPlayerController::SetupInputs ( )
overrideprotectedvirtual

Reimplemented from APlayerControllerBase.

95{
96 Super::SetupInputs();
98 {
99 if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
100 {
101 FModifyContextOptions Options;
102 Options.bForceImmediately = 1;
103 Subsystem->AddMappingContext(DefaultInputMappingContext, 1, Options);
104 UALSDebugComponent* DebugComp = Cast<UALSDebugComponent>(PossessedCharacter->GetComponentByClass(UALSDebugComponent::StaticClass()));
105 if (DebugComp)
106 {
107 // Do only if we have debug component
108 Subsystem->AddMappingContext(DebugInputMappingContext, 0, Options);
109 }
110 }
111 }
112}

◆ SprintAction()

void AALSPlayerController::SprintAction ( const FInputActionValue & Value)
protected
169{
171 {
172 PossessedCharacter->SprintAction(Value.Get<bool>());
173 }
174}

◆ StanceAction()

void AALSPlayerController::StanceAction ( const FInputActionValue & Value)
protected
201{
202 if (PossessedCharacter && Value.Get<bool>())
203 {
204 PossessedCharacter->StanceAction();
205 }
206}

◆ VelocityDirectionAction()

void AALSPlayerController::VelocityDirectionAction ( const FInputActionValue & Value)
protected
225{
226 if (PossessedCharacter && Value.Get<bool>())
227 {
228 PossessedCharacter->VelocityDirectionAction();
229 }
230}

◆ WalkAction()

void AALSPlayerController::WalkAction ( const FInputActionValue & Value)
protected
209{
210 if (PossessedCharacter && Value.Get<bool>())
211 {
212 PossessedCharacter->WalkAction();
213 }
214}

Member Data Documentation

◆ DebugInputMappingContext

TObjectPtr<UInputMappingContext> AALSPlayerController::DebugInputMappingContext = nullptr

◆ DefaultInputMappingContext

TObjectPtr<UInputMappingContext> AALSPlayerController::DefaultInputMappingContext = nullptr

◆ PossessedCharacter

TObjectPtr<AALSBaseCharacter> AALSPlayerController::PossessedCharacter = nullptr

Main character reference


The documentation for this class was generated from the following files: