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();
+16 -1
View File
@@ -1,9 +1,9 @@
#include "CogSampleBasicActor.h"
#include "GameFramework/GameStateBase.h"
#include "Net/Core/PushModel/PushModel.h"
#include "Net/UnrealNetwork.h"
//--------------------------------------------------------------------------------------------------------------------------
ACogSampleBasicActor::ACogSampleBasicActor(const FObjectInitializer& ObjectInitializer)
{
@@ -22,6 +22,21 @@ void ACogSampleBasicActor::GetLifetimeReplicatedProps(TArray< FLifetimeProperty
DOREPLIFETIME_WITH_PARAMS_FAST(ACogSampleBasicActor, Creator, Params);
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleBasicActor::BeginPlay()
{
//-----------------------------------------------------
// Set default creator before Super::BeginPlay()
// so component can access it inside they BeginPlay()
//-----------------------------------------------------
if (Creator == nullptr)
{
Creator = GetWorld()->GetGameState();
}
Super::BeginPlay();
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogSampleBasicActor::SetTeam(int32 Value)
{
+2
View File
@@ -19,6 +19,8 @@ class ACogSampleBasicActor : public AActor
public:
ACogSampleBasicActor(const FObjectInitializer& ObjectInitializer);
virtual void BeginPlay();
UFUNCTION(BlueprintPure)
virtual int32 GetTeam() const override { return Team; }
+1
View File
@@ -9,6 +9,7 @@
- CogEngine: Add more info in stats tooltip (details, curves, ...)
- CogEngine: Add screen settings (fullscreen, borderless, window and resolution)
- CogEngine: make a better widget for CheckBoxState for input shortcuts
- CogEngine: save active log categories
- CogSample: Add a custom window in sample (changing the character faction)
- CogSample: Create more abilities