Rewind Game Modeh
Rewind Game Modeh
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "RewindGameMode.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnGlobalRewindStarted);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnGlobalRewindCompleted);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnGlobalFastForwardStarted);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnGlobalFastForwardCompleted);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnGlobalTimeScrubStarted);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnGlobalTimeScrubCompleted);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnGlobalTimelineVisualizationEnabled);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnGlobalTimelineVisualizationDisabled);
UCLASS(minimalapi)
class ARewindGameMode : public AGameModeBase
{
GENERATED_BODY()
public:
ARewindGameMode();
// Desired length of longest rewind; used to compute the rewind buffer size
UPROPERTY(EditDefaultsOnly, Category = "Rewind")
float MaxRewindSeconds = 120.0f;
private:
UPROPERTY(Transient, VisibleAnywhere, Category = "Rewind")
bool bIsGlobalTimeScrubbing = false;
public:
// Returns whether the component is currently rewinding
UFUNCTION(BlueprintCallable, Category = "Rewind")
bool IsGlobalTimeScrubbing() const { return bIsGlobalTimeScrubbing; };
private:
UPROPERTY(Transient, VisibleAnywhere, Category = "Rewind")
bool bIsGlobalTimelineVisualizationEnabled = false;
public:
// Returns whether the timeline visualization is currently enabled
UFUNCTION(BlueprintCallable, Category = "Rewind")
bool IsGlobalTimelineVisualizationEnabled() const { return
bIsGlobalTimelineVisualizationEnabled; };
private:
UPROPERTY(Transient, VisibleAnywhere, Category = "Rewind")
bool bIsGlobalRewinding = false;
public:
// Returns whether rewinding is currently enabled
UFUNCTION(BlueprintCallable, Category = "Rewind")
bool IsGlobalRewinding() const { return bIsGlobalRewinding; };
private:
UPROPERTY(Transient, VisibleAnywhere, Category = "Rewind")
bool bIsGlobalFastForwarding = false;
public:
// Returns whether fast forwarding is currently enabled
UFUNCTION(BlueprintCallable, Category = "Rewind")
bool IsGlobalFastForwarding() const { return bIsGlobalFastForwarding; };
private:
UPROPERTY(Transient, VisibleAnywhere, Category = "Rewind")
float GlobalRewindSpeed = 1.0f;
public:
// Returns the current global time dilation
UFUNCTION(BlueprintCallable, Category = "Rewind")
float GetGlobalRewindSpeed() const { return GlobalRewindSpeed; }
};