Space Plunder
Loading...
Searching...
No Matches
CustomPlayerController.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "GameplayTagContainer.h"
8#include "GenericTeamAgentInterface.h"
9#include "Data/MenuData.h"
14#include "CustomPlayerController.generated.h"
15
16struct FMatchState;
17struct FTeamScoreData;
18struct FPlayerDeath;
19class UInputMappingContext;
20struct FGenericTeamId;
21
22UCLASS()
23class CUSTOMALS_API ACustomPlayerController : public AALSPlayerController, public IGenericTeamAgentInterface, public IInputKeyInterface
24{
25 GENERATED_BODY()
26
27 //@ TODO HUD Should only be Used with Interfaces and remove Hard Reference
28
29public:
31
32 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Custom ALS")
33 TObjectPtr<class ACustomPlayerCharacter> PossessedCustomCharacter = nullptr;
34
35
36 //@TODO Remove this and replace with Interface in PC base
37 UFUNCTION(BlueprintCallable, Category = "Custom ALS")
38 class ACustomPlayerState* GetCustomPlayerState() const;
39 UFUNCTION(BlueprintCallable, Category = "Custom ALS")
40 class ACustomHUD* GetCustomHUD() const{return HUD;};
41
42
43 //- Multiplayer HUD //
44 UFUNCTION(Client, Reliable, Category = "Custom ALS")
45 void ClientAddDeathToKillFeed(FPlayerDeath PlayerDeath, bool bPlayerDeath = true);
46 UFUNCTION(Client, Reliable, Category = "Custom ALS")
47 void ClientUpdateScore(const TArray<FTeamScoreData>& Scores);
48
49 UFUNCTION(Client, Reliable, Category = "Custom ALS")
50 void ClientSetMultiplayerMode(const EMultiplayerMode Mode);
51 UFUNCTION(Client, Reliable, Category = "Custom ALS")
52 void ClientSetRound(const int32 Num);
53 UFUNCTION(Client, Reliable, Category = "Custom ALS")
54 void ClientSetMultiplayerMatchState(FMatchState State);
55
56 UFUNCTION(Client, Reliable, Category = "Custom ALS")
57 virtual void MatchOver(FMatchState MatchState, const TArray<FTeamScoreData>& Scores);
58 UFUNCTION(Client, Reliable, Category = "Custom ALS")
59 virtual void RoundOver(FMatchState MatchState, const TArray<FTeamScoreData>& Scores);
60
61
62
63 virtual void SetupInputComponent() override;
64 virtual void BindActions(UInputMappingContext* Context) override;
65
66 virtual UInputMappingContext* GetInputActions() override {return DefaultInputMappingContext.Get();};
67 UFUNCTION(BlueprintCallable, Category="Controller")
68 virtual EGameControllerType GetControllerType() override;
69
70
71 UFUNCTION(BlueprintCallable, Category="Multiplayer")
72 void SetMultiplayerTeamID(const int32 MultiplayerTeam){MultiplayerTeamID = MultiplayerTeam;};
73
74 UFUNCTION(BlueprintCallable, Category="Player Controller|Multiplayer")
75 void GetScore();
76
77 // UFUNCTION(BlueprintCallable, Category="Player Controller|Input")
78 // bool GetElapsedSeconds(float& ElapsedTime, UInputAction* Action) const;
79
80protected:
81
82 virtual void BeginPlay() override;
83 virtual void OnUnPossess() override;
84 virtual void OnPossess(APawn* NewPawn) override;
85 virtual void OnRep_Pawn() override;
86
87 virtual void SetAimAssistLevel(const int32 Value) override;
88
89
90 virtual void OnPawnSpawn() override;
91 virtual void OnPawnSpawnComplete() override;
92
93 // virtual bool SaveCurrentPlayerOptions() override;
94
95 // virtual bool LoadPlayerOptions(const FString& SlotName = "Default") override;
96 // virtual bool SavePlayerOptions(const FString& SlotName = "Default") override;
97 virtual void ApplySettings(const USettingsSaveGame* LoadedPlayerSettings) override;
98
99 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Chat System")
100 class UChatSystemComponent* ChatSystemComponent;
101 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Quest System")
102 class UQuestPlayerComponent* QuestPlayerComponent;
103 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Aim Assist")
104 class UAimAssistComponent* AimAssistComponent;
105 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="HUD")
106 class ACustomHUD* HUD;
107 class IMultiplayerGS* MultiplayerGS;
108 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="HUD")
109 class AMultiplayerGameMode* MultiplayerGM;
110
111 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Controller|Tag")
112 FGameplayTagContainer Container;
113 //- //
114 //- Input Actions //
115 //- //
116
117 void SetupCustomInputs();
118
119
120 UFUNCTION()
121 void UseAction(const FInputActionValue& Value) const;
122 UFUNCTION()
123 void ShootAction(const FInputActionValue& Value) const;
124 UFUNCTION()
125 void ReloadAction(const FInputActionValue& Value) const;
126 UFUNCTION()
127 void MeleeAction(const FInputActionValue& Value) const;
128 UFUNCTION()
129 void GrabAction(const FInputActionValue& Value) const;
130 UFUNCTION()
131 void QuickSaveAction(const FInputActionValue& Value) const;
132 UFUNCTION()
133 void QuickLoadAction(const FInputActionValue& Value) const;
134 UFUNCTION()
135 void AutoModeAction(const FInputActionValue& Value) const;
136 UFUNCTION()
137 void ThrowAction(const FInputActionValue& Value) const;
138 UFUNCTION()
139 void SwapWeaponAction(const FInputActionValue& Value) const;
140 UFUNCTION()
141 void HolsterAction(const FInputActionValue& Value) const;
142 UFUNCTION()
143 void PauseAction(const FInputActionValue& Value);
144 UFUNCTION()
145 void ChatAction(const FInputActionValue& Value) const;
146 UFUNCTION()
147 void QuestMenuAction(const FInputActionValue& Value);
148 UFUNCTION()
149 void PingAction(const FInputActionValue& Value) const;
150 UFUNCTION()
151 void PingHeldAction(const FInputActionValue& Value) const;
152 // UFUNCTION()
153 // void CharacterModeAction(const FInputActionValue& Value);
154
155 UFUNCTION()
156 void ReportBugAction(const FInputActionValue& Value);
157
158 UFUNCTION()
159 void ToggleQuestLogMenu();
160 UFUNCTION()
161 void ScoreboardMenuAction(const FInputActionValue& Value) const;
162
163 //~ Overridden ~//
164 virtual void SelectionUpAction(const FInputActionValue& Value) override;
165
166 virtual void AimAction(const FInputActionValue& Value) override;
167 virtual void CameraUpAction(const FInputActionValue& Value) override;
168 virtual void CameraRightAction(const FInputActionValue& Value) override;
169 //~ Overridden ~//
170
171
172 //- Implement The Generic Team Interface
173 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Perception")
174 uint8 TeamID = 1;
175 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Multiplayer")
176 uint8 MultiplayerTeamID = 1;
177
178 //~ Gets what should be Currently used, Considers Aiming, and Overlay State //
179 UFUNCTION(BlueprintCallable, Category="Player Options")
180 float CalculateCameraSensitivity(const float CameraInput) const;
181
182 //@TODO multiplayer delay time should check if it actually got updated and loop
183 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Multiplayer")
184 float MultiplayerDelayTime = 0.3f;
185 //- Once Setup, the delay to Send to the Pawn //
186 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Multiplayer")
187 float PawnSpawnCompleteDelayTime = 0.3f;
188
189private:
190 int32 PawnSpawnAttempts = 0;
191 bool bBindMenuButtonOnce = false;
192
193 // FRadialMenuData CharacterModesMenuData;
194
195 UPROPERTY(EditAnywhere, Category="Controller|Debug")
196 TSubclassOf<UUserWidget> SubmitReportWidgetClass;
197
198 // UPROPERTY(VisibleAnywhere, Category="Controller|Status")
199 // bool bAimed = false;
200
201
202 //- Menu (Game Instance) Reference
204
205 //- A delay for Setting HUD and Component Elements //
206 FTimerHandle SetupCompleteDelayTimerHandle;
207 FTimerHandle SetupRetryDelayTimerHandle;
208
209 //- A delay for making sure everything is already setup, Comes After Setup //
210 FTimerHandle SpawnCompleteDelayTimerHandle;
211 FTimerHandle UpdateScoreDelayTimerHandle;
212};
213
EGameControllerType
Definition BaseData.h:97
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
EMultiplayerMode
Definition MultiplayerData.h:10
Definition ALSPlayerController.h:19
Definition CustomHUD.h:23
Definition CustomPlayerCharacter.h:13
Definition CustomPlayerController.h:24
Definition CustomPlayerState.h:16
Definition MultiplayerGameMode.h:17
Definition InputKeyInterface.h:21
Definition MenuSystem.h:19
Definition MultiplayerGS.h:17
Definition MenuSystem.Build.cs:6
This class provides aim assist functionality for player controllers in a game.
Definition SettingsSaveGame.h:88
Definition BaseData.h:1077
Definition BaseData.h:613
Definition MultiplayerData.h:37