CogSample: progress on projectiles

This commit is contained in:
Arnaud Jamin
2023-10-30 01:11:48 -04:00
parent be498905bc
commit 315782183d
32 changed files with 224 additions and 60 deletions
@@ -11,6 +11,7 @@
#if ENABLE_COG
#include "CogAbilityReplicator.h"
#include "CogDebugDraw.h"
#include "CogDebugPlot.h"
#include "CogDebugReplicator.h"
#include "CogEngineReplicator.h"
#endif //ENABLE_COG
@@ -202,3 +203,29 @@ void ACogSamplePlayerController::Server_SetTarget_Implementation(AActor* Value)
{
Target = Value;
}
//--------------------------------------------------------------------------------------------------------------------------
const ACogSamplePlayerController* ACogSamplePlayerController::GetFirstLocalPlayerController(UObject* WorldContextObject)
{
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
if (World == nullptr)
{
return nullptr;
}
UGameInstance* const GameInstance = World->GetGameInstance();
if (GameInstance == nullptr)
{
return nullptr;
}
ACogSamplePlayerController* PlayerController = Cast<ACogSamplePlayerController>(GameInstance->GetFirstLocalPlayerController(World));
return PlayerController;
}
//--------------------------------------------------------------------------------------------------------------------------
float ACogSamplePlayerController::GetClientLag() const
{
return (PlayerState != nullptr && GetNetMode() != NM_Standalone) ? (0.0001f * 0.5f * PlayerState->ExactPing) : 0.f;
}