spacepaste

  1.  
  2. bool speed_state = false;
  3. kryptonian_powers::speed {
  4. speed_state = !speed_state;
  5. if (speed_state == true) {
  6. UGameplayStatics::SetGlobalTimeDilation(GetWorld(), 0.5); //Global slow motion.
  7. this->CustomTimeDilation = 2; // Individual slow motion.
  8. }
  9. else {
  10. UGameplayStatics::SetGlobalTimeDilation(GetWorld(), 1.0); //Global slow motion.
  11. this->CustomTimeDilation = 1.0; // Individual slow motion.
  12. }
  13. if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow,
  14. FString::Printf(
  15. TEXT("World delta for current frame equals %f"),
  16. GetWorld()->TimeSeconds
  17. )
  18. );
  19. }
  20.