Photon Quantum 3.0.0

Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Quantum.QuantumInstantReplay Class Reference

The instant replay feature. It can be used as is or used as a base class for custom instant replay implementations. More...

Inherits IDisposable.

Public Member Functions

 QuantumInstantReplay (QuantumGame liveGame, float length, QuantumInstantReplaySeekMode seekMode=QuantumInstantReplaySeekMode.Disabled, bool loop=false)
 Create and start an instant replay. More...
 
void Dispose ()
 Stop and dispose the instant replay by clearing cached snapshots and shutting down the replay runner. More...
 
void SeekFrame (int frameNumber)
 Seek to a desired frame number during the running instant replay. More...
 
void SeekNormalizedTime (float normalizedTime)
 Seek the replay by inputting a normalized time [0..1]. More...
 
bool Update (float deltaTime)
 Updates the instant replay session. Will loop the replay if enabled. More...
 

Public Attributes

bool CanSeek => _rewindSnapshots?.Count > 0
 Returns true if the instant replay can seek to a desired frame. More...
 
int CurrentFrame => _replayRunner.Game.Frames.Verified.Number
 Returns current frame number of the replay. More...
 
bool IsRunning => CurrentFrame < EndFrame
 Returns true is the instant replay is running. More...
 
QuantumGame ReplayGame => _replayRunner?.Game
 Returns the replay Quantum Game or null. More...
 

Static Public Attributes

const int InitialFramesToSimulation = 4
 We need this to fast forward the simulation and wait until is fully initialized. More...
 

Properties

int EndFrame [get]
 Returns the last frame number of the replay which is usually the end frame of the original game when the instant replay was started. More...
 
QuantumGame LiveGame [get]
 Returns the live Quantum Game. More...
 
float NormalizedTime [get]
 Returns the progress or normalized time [0..1] of the instant replay. More...
 
int StartFrame [get]
 Returns the frame number the instant replay started from. More...
 

Detailed Description

The instant replay feature. It can be used as is or used as a base class for custom instant replay implementations.

Constructor & Destructor Documentation

◆ QuantumInstantReplay()

Quantum.QuantumInstantReplay.QuantumInstantReplay ( QuantumGame  liveGame,
float  length,
QuantumInstantReplaySeekMode  seekMode = QuantumInstantReplaySeekMode.Disabled,
bool  loop = false 
)
inline

Create and start an instant replay.

Parameters
liveGameThe original game.
lengthThe time in seconds to rewind the original game and start the instant replay from.
seekModeAn optional seek mode to seek and rewind the running instant replay.
loopAutomatically loop the instant replay and never stop.
Exceptions
ArgumentNullExceptionIs raised when the live game is null.
ArgumentExceptionIs raised when no valid snapshot was found to start the replay from.

Member Function Documentation

◆ Dispose()

void Quantum.QuantumInstantReplay.Dispose ( )
inline

Stop and dispose the instant replay by clearing cached snapshots and shutting down the replay runner.

◆ SeekFrame()

void Quantum.QuantumInstantReplay.SeekFrame ( int  frameNumber)
inline

Seek to a desired frame number during the running instant replay.

Parameters
frameNumberDesired frame number.
Exceptions
InvalidOperationExceptionIs raised when the replay is not seek-able.
ArgumentOutOfRangeExceptionIs raised when the desired frame could not be reached by the cached snapshots.

◆ SeekNormalizedTime()

void Quantum.QuantumInstantReplay.SeekNormalizedTime ( float  normalizedTime)
inline

Seek the replay by inputting a normalized time [0..1].

Parameters
normalizedTimeReplay progress between 0 and 1.

◆ Update()

bool Quantum.QuantumInstantReplay.Update ( float  deltaTime)
inline

Updates the instant replay session. Will loop the replay if enabled.

Parameters
deltaTimePassed delta time in seconds.
Returns
Returns true is the replay is complete.

Member Data Documentation

◆ InitialFramesToSimulation

const int Quantum.QuantumInstantReplay.InitialFramesToSimulation = 4
static

We need this to fast forward the simulation and wait until is fully initialized.

◆ CurrentFrame

int Quantum.QuantumInstantReplay.CurrentFrame => _replayRunner.Game.Frames.Verified.Number

Returns current frame number of the replay.

◆ CanSeek

bool Quantum.QuantumInstantReplay.CanSeek => _rewindSnapshots?.Count > 0

Returns true if the instant replay can seek to a desired frame.

◆ IsRunning

bool Quantum.QuantumInstantReplay.IsRunning => CurrentFrame < EndFrame

Returns true is the instant replay is running.

◆ ReplayGame

QuantumGame Quantum.QuantumInstantReplay.ReplayGame => _replayRunner?.Game

Returns the replay Quantum Game or null.

Property Documentation

◆ StartFrame

int Quantum.QuantumInstantReplay.StartFrame
get

Returns the frame number the instant replay started from.

◆ EndFrame

int Quantum.QuantumInstantReplay.EndFrame
get

Returns the last frame number of the replay which is usually the end frame of the original game when the instant replay was started.

◆ LiveGame

QuantumGame Quantum.QuantumInstantReplay.LiveGame
get

Returns the live Quantum Game.

◆ NormalizedTime

float Quantum.QuantumInstantReplay.NormalizedTime
get

Returns the progress or normalized time [0..1] of the instant replay.