13 changed files with 14 additions and 8 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+13 -7
View File
@@ -49,8 +49,6 @@ ABugPlacerPawn::ABugPlacerPawn()
void ABugPlacerPawn::BeginPlay() void ABugPlacerPawn::BeginPlay()
{ {
this->OriginalPlayer = UGameplayStatics::GetPlayerCharacter(this, 0);
this->Activate(); this->Activate();
Super::BeginPlay(); Super::BeginPlay();
@@ -129,6 +127,9 @@ void ABugPlacerPawn::TraceTimerElapsed()
this->TraceOriginComponent->SetRelativeScale3D(FVector(TraceOriginScale.X, TraceOriginScale.Y, (TraceEnd - TraceStart).Length())); this->TraceOriginComponent->SetRelativeScale3D(FVector(TraceOriginScale.X, TraceOriginScale.Y, (TraceEnd - TraceStart).Length()));
} }
} }
float TraceInterval = this->GetActorTickInterval() > 0.0f ? this->GetActorTickInterval() : (1.0f / 60.0f) * World->GetWorldSettings()->MinGlobalTimeDilation;
this->GetWorldTimerManager().SetTimer(this->TraceTimerHandle, this, &ABugPlacerPawn::TraceTimerElapsed, TraceInterval, false);
} }
@@ -159,14 +160,17 @@ void ABugPlacerPawn::Activate()
{ {
this->SavedMaxSpeed = this->PawnMovement->GetMaxSpeed(); this->SavedMaxSpeed = this->PawnMovement->GetMaxSpeed();
UGameplayStatics::GetPlayerController(this, 0)->Possess(this); APlayerController *Controller = UGameplayStatics::GetPlayerController(this, 0);
this->OriginalPawn = Controller->GetPawn();
this->OriginalPawn->DisableInput(Controller);
Controller->Possess(this);
const float &MinTimeDilation = this->GetWorldSettings()->MinGlobalTimeDilation; const float &MinTimeDilation = this->GetWorldSettings()->MinGlobalTimeDilation;
this->GetWorldSettings()->SetTimeDilation(MinTimeDilation); //this->GetWorldSettings()->SetTimeDilation(MinTimeDilation);
this->CustomTimeDilation = 1.0 / MinTimeDilation; //this->CustomTimeDilation = 1.0 / MinTimeDilation;
float TraceInterval = this->GetActorTickInterval() > 0.0f ? this->GetActorTickInterval() : (1.0f / 60.0f) * MinTimeDilation; float TraceInterval = this->GetActorTickInterval() > 0.0f ? this->GetActorTickInterval() : (1.0f / 60.0f) * MinTimeDilation;
this->GetWorldTimerManager().SetTimer(this->TraceTimerHandle, this, &ABugPlacerPawn::TraceTimerElapsed, TraceInterval, true); this->GetWorldTimerManager().SetTimer(this->TraceTimerHandle, this, &ABugPlacerPawn::TraceTimerElapsed, TraceInterval, false);
} }
void ABugPlacerPawn::Deactivate() void ABugPlacerPawn::Deactivate()
@@ -174,7 +178,9 @@ void ABugPlacerPawn::Deactivate()
this->GetWorldTimerManager().ClearAllTimersForObject(this); this->GetWorldTimerManager().ClearAllTimersForObject(this);
this->GetWorldSettings()->SetTimeDilation(1.0f); this->GetWorldSettings()->SetTimeDilation(1.0f);
UGameplayStatics::GetPlayerController(this, 0)->Possess(this->OriginalPlayer); APlayerController *Controller = UGameplayStatics::GetPlayerController(this, 0);
Controller->Possess(this->OriginalPawn);
this->OriginalPawn->EnableInput(Controller);
this->Destroy(); this->Destroy();
} }
+1 -1
View File
@@ -84,7 +84,7 @@ private:
uint8 bArbitraryPlacement : 1; uint8 bArbitraryPlacement : 1;
uint8 bCurrentTraceHit : 1; uint8 bCurrentTraceHit : 1;
TObjectPtr<class ACharacter> OriginalPlayer; TObjectPtr<class APawn> OriginalPawn;
TObjectPtr<class ABugMarkerActor> BugMarker; TObjectPtr<class ABugMarkerActor> BugMarker;