QTE bugfix and UI improve

This commit is contained in:
Oleg Petruny 2025-05-20 18:37:21 +02:00
parent 727921f1a4
commit 1ea3f9cbb4
4 changed files with 14 additions and 16 deletions

View File

@ -91,31 +91,29 @@ namespace SlowMotion
void UCommonFunctions::EnterSlowMotion(float duration)
{
if(SlowMotion::targetDilation == SlowMotion::slowDilation)
return;
SlowMotion::targetDilation = SlowMotion::slowDilation;
auto GI = UCustomGameInstance::Get();
if(!GI)
return;
auto world = GI->GetWorld();
if(FloatIsZero(UGameplayStatics::GetGlobalTimeDilation(world) - SlowMotion::slowDilation))
return;
SlowMotion::targetDilation = SlowMotion::slowDilation;
world->GetTimerManager().SetTimer(SlowMotion::timer, []() { SlowMotionTick(); }, 0.01f, true); // wrapped in lambda due to some template function class referencing
}
void UCommonFunctions::ExitSlowMotion(float duration)
{
if(SlowMotion::targetDilation == SlowMotion::normalDilation)
return;
SlowMotion::targetDilation = SlowMotion::normalDilation;
auto GI = UCustomGameInstance::Get();
if(!GI)
return;
auto world = GI->GetWorld();
if(FloatIsZero(UGameplayStatics::GetGlobalTimeDilation(world) - SlowMotion::normalDilation))
return;
SlowMotion::targetDilation = SlowMotion::normalDilation;
world->GetTimerManager().SetTimer(SlowMotion::timer, []() { SlowMotionTick(); }, 0.01f, true);
}