Skip to content

Commit

Permalink
pressing 'Escape' or 'M' while the RaceHUD is on pause the game (and …
Browse files Browse the repository at this point in the history
…the time) or unpause it
  • Loading branch information
yosmont committed Jan 16, 2023
1 parent d3d9c9e commit c6f6631
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Source/KO_Racing/MyRaceUserWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void UMyRaceUserWidget::ChangeSpeedValue(float value)
void UMyRaceUserWidget::StartTimer()
{
_timer = 0;
_beforeStart = 4;
_beforeStart = 3;
_timerIsStarted = true;
}

Expand Down Expand Up @@ -70,9 +70,11 @@ void UMyRaceUserWidget::UpdateTimer(float deltaTime)
_timerTxt->SetText(FText::FromString(GenTimerFString(_timer)));
} else {
_beforeStart -= deltaTime;
_beforeStartTimerTxt->ChangeValue(_beforeStart);
if (_beforeStart <= 0)
_beforeStartTimerTxt->ChangeValue(_beforeStart + 1);
if (_beforeStart <= 0) {
_raceAsStarted = true;
_beforeStartTimerTxt->SetVisibility(ESlateVisibility::Hidden);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/KO_Racing/MyRaceUserWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class KO_RACING_API UMyRaceUserWidget : public UUserWidget
static std::string GenTimerString(float time);

float _timer = 0;
float _beforeStart = 4;
float _beforeStart = 3;
bool _timerIsStarted = false;
TArray<float> _lapTime;
float _lastLapTimer = 0;
Expand Down

0 comments on commit c6f6631

Please sign in to comment.