RealtimeStyleTransferRuntime/Source/LyraGame/UI/Weapons/LyraWeaponUserInterface.cpp

52 lines
1.3 KiB
C++
Raw Permalink Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "LyraWeaponUserInterface.h"
2022-09-13 07:18:28 +00:00
2022-05-23 18:41:30 +00:00
#include "Equipment/LyraEquipmentManagerComponent.h"
#include "GameFramework/Pawn.h"
2022-09-13 07:18:28 +00:00
#include "Weapons/LyraWeaponInstance.h"
struct FGeometry;
2022-05-23 18:41:30 +00:00
ULyraWeaponUserInterface::ULyraWeaponUserInterface(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
void ULyraWeaponUserInterface::NativeConstruct()
{
Super::NativeConstruct();
}
void ULyraWeaponUserInterface::NativeDestruct()
{
Super::NativeDestruct();
}
void ULyraWeaponUserInterface::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
{
Super::NativeTick(MyGeometry, InDeltaTime);
if (APawn* Pawn = GetOwningPlayerPawn())
{
if (ULyraEquipmentManagerComponent* EquipmentManager = Pawn->FindComponentByClass<ULyraEquipmentManagerComponent>())
{
if (ULyraWeaponInstance* NewInstance = EquipmentManager->GetFirstInstanceOfType<ULyraWeaponInstance>())
{
if (NewInstance != CurrentInstance && NewInstance->GetInstigator() != nullptr)
{
ULyraWeaponInstance* OldWeapon = CurrentInstance;
CurrentInstance = NewInstance;
RebuildWidgetFromWeapon();
OnWeaponChanged(OldWeapon, CurrentInstance);
}
}
}
}
}
void ULyraWeaponUserInterface::RebuildWidgetFromWeapon()
{
}