// Called when the game starts or when spawned void AMyPawnCpp::BeginPlay() { Super::BeginPlay(); UpdateTimerDisplay(); GetWorldTimerManager().SetTimer(CountdownTimerHandle, this, &AMyPawnCpp::AdvanceTimer, 1.0f, true); }
// Called when the game starts or when spawned void ACountDown::BeginPlay() { Super::BeginPlay(); //Tutorial UpdateTimerDisplay(); GetWorldTimerManager().SetTimer(CountdownTimerHandle, this, &ACountDown::AdvanceTimer, 1.0f, true); }
void ACountDown::AdvanceTimer() { --CountdownTime; UpdateTimerDisplay(); if (CountdownTime < 1) { // We are done cutting down, so stop running the timer. GetWorldTimerManager().ClearTimer(CountdownTimerHandle); CountdownHasFinished(); } }
void ACountdown::AdvanceTimer() { --CountdownTime; UpdateTimerDisplay(); if (CountdownTime < 1) { // We're done counting down, so stop running the timer. GetWorldTimerManager().ClearTimer(CountdownTimerHandle); // Perform any special actions we want to do when the timer ends. CountdownHasFinished(); } }
// Called when the game starts or when spawned void ACountdown::BeginPlay() { Super::BeginPlay(); UpdateTimerDisplay(); GetWorldTimerManager().SetTimer(CountdownTimerHandle, this, &ACountdown::AdvanceTimer, 1.0f, true); UE_LOG(QuickStart, Log, TEXT("ACountdown::BeginPlay()")); if (GEngine) { GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Blue, "ACountdown::BeginPlay()"); } }