- Time scaling caused too many issues, and has been removed.

- Since time scaling is no longer used, markers are now placed using a timer instead of on tick.
This commit is contained in:
Jamie Greunbaum 2023-03-24 17:42:43 -04:00
parent 32d0d61e67
commit d2cb047651
3 changed files with 13 additions and 15 deletions

Binary file not shown.

View File

@ -10,6 +10,7 @@
#include "Components/SphereComponent.h"
#include "GameFramework/Character.h"
#include "GameFramework/FloatingPawnMovement.h"
#include "HAL/IConsoleManager.h"
#include "Kismet/GameplayStatics.h"
@ -46,9 +47,6 @@ ABugPlacerPawn::ABugPlacerPawn()
void ABugPlacerPawn::BeginPlay()
{
this->GetWorldSettings()->SetTimeDilation(this->GetWorldSettings()->MinGlobalTimeDilation);
this->CustomTimeDilation = 1.0f / this->GetWorldSettings()->MinGlobalTimeDilation;
this->OriginalPlayer = UGameplayStatics::GetPlayerCharacter(this, 0);
this->Activate();
@ -56,15 +54,7 @@ void ABugPlacerPawn::BeginPlay()
Super::BeginPlay();
}
void ABugPlacerPawn::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
this->CustomTimeDilation = 1.0f;
this->GetWorldSettings()->SetTimeDilation(1.0f);
Super::EndPlay(EndPlayReason);
}
void ABugPlacerPawn::Tick(float DeltaSeconds)
void ABugPlacerPawn::TraceTimerElapsed()
{
const UWorld *World = this->GetWorld();
@ -140,10 +130,15 @@ void ABugPlacerPawn::Activate()
this->SavedMaxSpeed = this->PawnMovement->GetMaxSpeed();
UGameplayStatics::GetPlayerController(this, 0)->Possess(this);
float TraceInterval = this->GetActorTickInterval() > 0.0f ? this->GetActorTickInterval() : 1.0f / 30.0f;
this->GetWorldTimerManager().SetTimer(this->TraceTimerHandle, this, &ABugPlacerPawn::TraceTimerElapsed, TraceInterval, true);
}
void ABugPlacerPawn::Deactivate()
{
this->GetWorldTimerManager().ClearAllTimersForObject(this);
UGameplayStatics::GetPlayerController(this, 0)->Possess(this->OriginalPlayer);
this->Destroy();

View File

@ -17,9 +17,6 @@ public:
ABugPlacerPawn();
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
virtual void Tick(float DeltaSeconds) override;
UFUNCTION(BlueprintCallable)
void Activate();
@ -72,6 +69,8 @@ protected:
float SavedMaxSpeed = 0.0f;
private:
void TraceTimerElapsed();
uint8 bArbitraryPlacement : 1;
uint8 bCurrentTraceHit : 1;
@ -79,4 +78,8 @@ private:
TObjectPtr<class ABugMarkerActor> BugMarker;
TObjectPtr<class UExitingBugPlacementScreen> ExitingBugPlacementScreen;
//UPROPERTY(EditDefaultsOnly, meta=(UIMin="0.0", UIMax="0.25"))
// float TraceTimerDelay = 0.05f;
FTimerHandle TraceTimerHandle;
};