RealtimeStyleTransferRuntime/Source/LyraGame/Camera/LyraUICameraManagerComponen...

67 lines
1.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "LyraUICameraManagerComponent.h"
#include "Delegates/Delegate.h"
#include "GameFramework/HUD.h"
#include "GameFramework/PlayerController.h"
#include "LyraPlayerCameraManager.h"
#include "Misc/CoreMisc.h"
#include "Templates/Casts.h"
#include "Templates/UnrealTemplate.h"
class AActor;
class FDebugDisplayInfo;
ULyraUICameraManagerComponent* ULyraUICameraManagerComponent::GetComponent(APlayerController* PC)
{
if (PC != nullptr)
{
if (ALyraPlayerCameraManager* PCCamera = Cast<ALyraPlayerCameraManager>(PC->PlayerCameraManager))
{
return PCCamera->GetUICameraComponent();
}
}
return nullptr;
}
ULyraUICameraManagerComponent::ULyraUICameraManagerComponent()
{
bWantsInitializeComponent = true;
if (!HasAnyFlags(RF_ClassDefaultObject))
{
// Register "showdebug" hook.
if (!IsRunningDedicatedServer())
{
AHUD::OnShowDebugInfo.AddUObject(this, &ThisClass::OnShowDebugInfo);
}
}
}
void ULyraUICameraManagerComponent::InitializeComponent()
{
Super::InitializeComponent();
}
void ULyraUICameraManagerComponent::SetViewTarget(AActor* InViewTarget, FViewTargetTransitionParams TransitionParams)
{
TGuardValue<bool> UpdatingViewTargetGuard(bUpdatingViewTarget, true);
ViewTarget = InViewTarget;
CastChecked<ALyraPlayerCameraManager>(GetOwner())->SetViewTarget(ViewTarget, TransitionParams);
}
bool ULyraUICameraManagerComponent::NeedsToUpdateViewTarget() const
{
return false;
}
void ULyraUICameraManagerComponent::UpdateViewTarget(struct FTViewTarget& OutVT, float DeltaTime)
{
}
void ULyraUICameraManagerComponent::OnShowDebugInfo(AHUD* HUD, UCanvas* Canvas, const FDebugDisplayInfo& DisplayInfo, float& YL, float& YPos)
{
}