- bool speed_state = false;
- kryptonian_powers::speed {
- speed_state = !speed_state;
- if (speed_state == true) {
- UGameplayStatics::SetGlobalTimeDilation(GetWorld(), 0.5); //Global slow motion.
- this->CustomTimeDilation = 2; // Individual slow motion.
- }
- else {
- UGameplayStatics::SetGlobalTimeDilation(GetWorld(), 1.0); //Global slow motion.
- this->CustomTimeDilation = 1.0; // Individual slow motion.
- }
- if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow,
- FString::Printf(
- TEXT("World delta for current frame equals %f"),
- GetWorld()->TimeSeconds
- )
- );
- }