This allows us to have custom implementations in our timers that perform very specific work. GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Orange, "Counting down to explosion: " + FString::FromInt(TriggerCountdown)) GetWorld()->GetTimerManager().SetTimer(TriggerDestroyTimerHandle, this, &ADestructibleProp::TriggerDestroy, RandomDelay, true) If (-TriggerCountdown AddOnScreenDebugMessage(-1, 3.f, FColor::Orange, "Boom ! with a delay of: " + FString::FromInt(RandomDelay)) cpp void ADestructibleProp::TriggerCountdownToDestroy() cpp GetWorld()->GetTimerManager().SetTimer(TriggerDestroyTimerHandle, this, &ADestructibleProp::TriggerCountdownToDestroy, 1.f, true) įinally we add in our implementation where we modify our count down variable by subtracting one from it every second.Īdditionally we trigger a second timer call to our original method by randomly generating a delay before it gets triggered. In this case we are going to simulate a fuse that will count down every second before it triggers an event.įirst we are going to call the timer as we did previously, except this time we are going to call a new method and have this timer run every second. Timers can also be used to trigger modifications to specific values every so often.
0 Comments
Leave a Reply. |