// Oleg Petruny proprietary.

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"

#include "CommonFunctions.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FWorldDilationChangedDelegate, float, newDilation);

UCLASS()
class UCommonFunctions : public UBlueprintFunctionLibrary
{
    GENERATED_BODY()

public:
    static bool IsNonGameObject(class UObject* object);
    static FText GetKeyDisplayName(struct FKey key);

    UFUNCTION(BlueprintCallable, Category = Actor)
    static void DestroyActorRecursively(class AActor* actor);



    UFUNCTION(BlueprintCallable, Category = Level)
    static class ALevelBase* GetCurrentLevelScript(class UObject* obj);

    UFUNCTION(BlueprintCallable, Category = Player)
    static class APlayerBase* GetPlayer(class UObject* obj);


    UFUNCTION(BlueprintCallable, Category = World)
    static void EnterSlowMotion(float duration = 1.0f);

    UFUNCTION(BlueprintCallable, Category = World)
    static void ExitSlowMotion(float duration = 1.0f);

    static FWorldDilationChangedDelegate& GetWorldDilationChangedDelegate();

private:
    static void SlowMotionTick();

};

namespace SlowMotion
{
    constexpr float normalDilation = 1.0f;
    constexpr float slowDilation = 0.2f;
    constexpr float interpolationSpeed = 0.1f;
}
