RealtimeStyleTransferRuntime/Source/LyraGame/Player/LyraPlayerController.h

154 lines
4.8 KiB
C
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Camera/LyraCameraAssistInterface.h"
2022-09-13 07:18:28 +00:00
#include "CommonPlayerController.h"
#include "Containers/Set.h"
#include "Containers/UnrealString.h"
#include "Engine/EngineTypes.h"
#include "GenericTeamAgentInterface.h"
#include "Math/UnrealMathSSE.h"
2022-05-23 18:41:30 +00:00
#include "Teams/LyraTeamAgentInterface.h"
2022-09-13 07:18:28 +00:00
#include "UObject/UObjectGlobals.h"
2022-05-23 18:41:30 +00:00
#include "LyraPlayerController.generated.h"
class ALyraHUD;
2022-09-13 07:18:28 +00:00
class ALyraPlayerState;
2022-05-23 18:41:30 +00:00
class APawn;
2022-09-13 07:18:28 +00:00
class APlayerState;
class FPrimitiveComponentId;
class IInputInterface;
class ULyraAbilitySystemComponent;
class ULyraSettingsShared;
class UObject;
class UPlayer;
struct FFrame;
2022-05-23 18:41:30 +00:00
/**
* ALyraPlayerController
*
* The base player controller class used by this project.
*/
UCLASS(Config = Game, Meta = (ShortTooltip = "The base player controller class used by this project."))
2022-09-13 07:18:28 +00:00
class LYRAGAME_API ALyraPlayerController : public ACommonPlayerController, public ILyraCameraAssistInterface, public ILyraTeamAgentInterface
2022-05-23 18:41:30 +00:00
{
GENERATED_BODY()
public:
ALyraPlayerController(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
UFUNCTION(BlueprintCallable, Category = "Lyra|PlayerController")
ALyraPlayerState* GetLyraPlayerState() const;
UFUNCTION(BlueprintCallable, Category = "Lyra|PlayerController")
ULyraAbilitySystemComponent* GetLyraAbilitySystemComponent() const;
UFUNCTION(BlueprintCallable, Category = "Lyra|PlayerController")
ALyraHUD* GetLyraHUD() const;
// Run a cheat command on the server.
UFUNCTION(Reliable, Server, WithValidation)
void ServerCheat(const FString& Msg);
// Run a cheat command on the server for all players.
UFUNCTION(Reliable, Server, WithValidation)
void ServerCheatAll(const FString& Msg);
//~AActor interface
virtual void PreInitializeComponents() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
//~End of AActor interface
//~AController interface
virtual void OnUnPossess() override;
//~End of AController interface
//~APlayerController interface
virtual void ReceivedPlayer() override;
virtual void PlayerTick(float DeltaTime) override;
//~End of APlayerController interface
//~ILyraCameraAssistInterface interface
virtual void OnCameraPenetratingTarget() override;
//~End of ILyraCameraAssistInterface interface
//~ACommonPlayerController interface
virtual void OnPossess(APawn* InPawn) override;
//~End of ACommonPlayerController interface
//~ILyraTeamAgentInterface interface
virtual void SetGenericTeamId(const FGenericTeamId& NewTeamID) override;
virtual FGenericTeamId GetGenericTeamId() const override;
virtual FOnLyraTeamIndexChangedDelegate* GetOnTeamIndexChangedDelegate() override;
//~End of ILyraTeamAgentInterface interface
UFUNCTION(BlueprintCallable, Category = "Lyra|Character")
void SetIsAutoRunning(const bool bEnabled);
UFUNCTION(BlueprintCallable, Category = "Lyra|Character")
bool GetIsAutoRunning() const;
private:
UPROPERTY()
FOnLyraTeamIndexChangedDelegate OnTeamChangedDelegate;
UPROPERTY()
2022-09-13 07:18:28 +00:00
TObjectPtr<APlayerState> LastSeenPlayerState;
2022-05-23 18:41:30 +00:00
private:
UFUNCTION()
void OnPlayerStateChangedTeam(UObject* TeamAgent, int32 OldTeam, int32 NewTeam);
protected:
// Called when the player state is set or cleared
virtual void OnPlayerStateChanged();
private:
void BroadcastOnPlayerStateChanged();
protected:
//~AController interface
virtual void InitPlayerState() override;
virtual void CleanupPlayerState() override;
virtual void OnRep_PlayerState() override;
//~End of AController interface
//~APlayerController interface
virtual void SetPlayer(UPlayer* InPlayer) override;
virtual void AddCheats(bool bForce) override;
virtual void UpdateForceFeedback(IInputInterface* InputInterface, const int32 ControllerId) override;
virtual void UpdateHiddenComponents(const FVector& ViewLocation, TSet<FPrimitiveComponentId>& OutHiddenComponents) override;
virtual void PreProcessInput(const float DeltaTime, const bool bGamePaused) override;
virtual void PostProcessInput(const float DeltaTime, const bool bGamePaused) override;
//~End of APlayerController interface
void OnSettingsChanged(ULyraSettingsShared* Settings);
void OnStartAutoRun();
void OnEndAutoRun();
UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName="OnStartAutoRun"))
void K2_OnStartAutoRun();
UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName="OnEndAutoRun"))
void K2_OnEndAutoRun();
bool bHideViewTargetPawnNextFrame = false;
};
// A player controller used for replay capture and playback
UCLASS()
class ALyraReplayPlayerController : public ALyraPlayerController
{
GENERATED_BODY()
virtual void SetPlayer(UPlayer* InPlayer) override;
};