RealtimeStyleTransferRuntime/Source/LyraGame/Messages/GameplayMessageProcessor.cpp

56 lines
1.2 KiB
C++
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "GameplayMessageProcessor.h"
2022-09-13 07:18:28 +00:00
#include "Engine/World.h"
2022-05-23 18:41:30 +00:00
#include "GameFramework/GameStateBase.h"
2022-09-13 07:18:28 +00:00
#include "Templates/UnrealTemplate.h"
2022-05-23 18:41:30 +00:00
void UGameplayMessageProcessor::BeginPlay()
{
Super::BeginPlay();
StartListening();
}
void UGameplayMessageProcessor::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
StopListening();
// Remove any listener handles
UGameplayMessageSubsystem& MessageSubsystem = UGameplayMessageSubsystem::Get(this);
for (FGameplayMessageListenerHandle& Handle : ListenerHandles)
{
MessageSubsystem.UnregisterListener(Handle);
}
ListenerHandles.Empty();
}
void UGameplayMessageProcessor::StartListening()
{
}
void UGameplayMessageProcessor::StopListening()
{
}
void UGameplayMessageProcessor::AddListenerHandle(FGameplayMessageListenerHandle&& Handle)
{
ListenerHandles.Add(MoveTemp(Handle));
}
double UGameplayMessageProcessor::GetServerTime() const
{
if (AGameStateBase* GameState = GetWorld()->GetGameState())
{
return GameState->GetServerWorldTimeSeconds();
}
else
{
return 0.0;
}
}