minor fixes

This commit is contained in:
Arnaud Jamin
2023-10-27 10:17:25 -04:00
parent 9a1fe2a348
commit b147b4b05f
7 changed files with 45 additions and 5 deletions
@@ -96,7 +96,7 @@ void ACogDebugReplicator::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>&
DOREPLIFETIME_WITH_PARAMS_FAST(ACogDebugReplicator, ReplicatedData, Params);
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogDebugReplicator::TickActor(float DeltaTime, enum ELevelTick TickType, FActorTickFunction& ThisTickFunction)
{
@@ -130,6 +130,26 @@ void ACogEngineReplicator::Server_Spawn_Implementation(const FCogEngineSpawnEntr
#endif // !UE_BUILD_SHIPPING
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogEngineReplicator::SetTimeDilation(float Value)
{
#if !UE_BUILD_SHIPPING
//-------------------------------------
// Set local time dilation right away
//-------------------------------------
TimeDilation = Value;
OnRep_TimeDilation();
//-------------------------------------
// Update server time dilation
//-------------------------------------
Server_SetTimeDilation(Value);
#endif // !UE_BUILD_SHIPPING
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogEngineReplicator::Server_SetTimeDilation_Implementation(float Value)
{
@@ -50,7 +50,7 @@ void FCogEngineWindow_TimeScale::RenderContent()
float Value = Replicator->GetTimeDilation();
if (FCogWindowWidgets::MultiChoiceButtonsFloat(TimingScales, Value, ImVec2(3.5f * FCogWindowWidgets::GetFontWidth(), 0)))
{
Replicator->Server_SetTimeDilation(Value);
Replicator->SetTimeDilation(Value);
}
}
@@ -39,8 +39,7 @@ public:
float GetTimeDilation() const { return TimeDilation; }
UFUNCTION(Server, Reliable)
void Server_SetTimeDilation(float Value);
void SetTimeDilation(float Value);
UFUNCTION(Server, Reliable)
void Server_Possess(APawn* Pawn);
@@ -50,6 +49,9 @@ public:
protected:
UFUNCTION(Server, Reliable)
void Server_SetTimeDilation(float Value);
UFUNCTION()
void OnRep_TimeDilation();