You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Added some APIs to the plugin to support unit testing without needing a UWorld, actors, etc. #jira UE-182327 #rb mattias.hornlund #preflight 642da9944d26bcd1eb1200b9 [CL 24931730 by Ryan Gerleve in ue5-main branch]
35 lines
949 B
C++
35 lines
949 B
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "NetPredictionTestWorld.h"
|
|
#include "NetworkPredictionWorldManager.h"
|
|
|
|
namespace UE::Net::Private
|
|
{
|
|
|
|
FNetPredictionTestWorld::FNetPredictionTestWorld(UNetworkPredictionSettingsObject* Settings, ENetMode InNetMode)
|
|
: NetMode(InNetMode)
|
|
{
|
|
WorldManager = NewObject<UNetworkPredictionWorldManager>();
|
|
if (Settings)
|
|
{
|
|
WorldManager->SyncNetworkPredictionSettings(Settings);
|
|
}
|
|
}
|
|
|
|
void FNetPredictionTestWorld::PreTick(int32 FixedFrameRate)
|
|
{
|
|
checkf(FixedFrameRate > 0, TEXT("FixedFrameRate must be > 0"));
|
|
WorldManager->OnWorldPreTick_Internal(1.0f / FixedFrameRate, FixedFrameRate);
|
|
}
|
|
|
|
void FNetPredictionTestWorld::Tick(int32 FixedFrameRate)
|
|
{
|
|
checkf(FixedFrameRate > 0, TEXT("FixedFrameRate must be > 0"));
|
|
if (NetMode == NM_Client)
|
|
{
|
|
WorldManager->ReconcileSimulationsPostNetworkUpdate_Internal();
|
|
}
|
|
WorldManager->BeginNewSimulationFrame_Internal(1.0f / FixedFrameRate);
|
|
}
|
|
|
|
} |