Photon Fusion 2.1.1

TickRate Struct Reference

A tick rate is a collection of tick rates. More...

Classes

struct  Resolved
 Represents a resolved tick rate. More...
struct  Selection
 Represents a selection of tick rates for client and server. More...

Public Types

enum  ValidateResult
 Enumerates the possible results of validating a tick rate selection. More...

Public Member Functions

Selection ClampSelection (Selection selection)
 Clamps the intervals in the specified Selection to valid ranges.
int GetDivisor (int index)
 Gets the divisor for the tick rate at the specified index.
int GetTickRate (int index)
 Gets the tick rate at the specified index.
int[] ToArray ()
 Converts the tick rates to an array.
ValidateResult ValidateSelection (Selection selected)
 Validates the tick rates in the specified Selection.

Static Public Member Functions

static TickRate Get (int rate)
 Retrieves the TickRate associated with the specified tick rate.
static bool IsValid (int rate)
 Checks if the provided tick rate is valid.
static bool IsValid (TickRate rate)
 Checks if the provided TickRate is valid.
static Resolved Resolve (Selection selection)
 Resolves the specified Selection into a Resolved structure.

Properties

readonly int Client [get]
 Gets the tick rate for the client.
readonly int Count [get]
 Gets the count of tick rates in the TickRate.
int this[int index] [get]
 Gets the tick rate at the specified index.

Detailed Description

A tick rate is a collection of tick rates.

Member Enumeration Documentation

◆ ValidateResult

Enumerates the possible results of validating a tick rate selection.

Enumerator
Ok 

The tick rate selection is valid.

Error 

An error occurred during validation.

NotFound 

The tick rate selection was not found.

InvalidTickRate 

The tick rate selection is invalid.

ServerIndexOutOfRange 

The server index in the tick rate selection is out of range.

ClientSendIndexOutOfRange 

The client send index in the tick rate selection is out of range.

ServerSendIndexOutOfRange 

The server send index in the tick rate selection is out of range.

ServerSendRateLargerThanTickRate 

The server send rate in the tick rate selection is larger than the tick rate.

Member Function Documentation

◆ ClampSelection()

Selection ClampSelection ( Selection selection)

Clamps the intervals in the specified Selection to valid ranges.

Parameters
selectionThe Selection to clamp.
Returns
A new Selection with clamped intervals. If its Client Tick Rate is invalid, returns a default Selection.

◆ Get()

TickRate Get ( int rate)
static

Retrieves the TickRate associated with the specified tick rate.

Parameters
rateThe tick rate to retrieve the TickRate for.
Returns
The TickRate associated with the specified tick rate.
Exceptions
InvalidOperationExceptionThrown when the tick rate is invalid.

◆ GetDivisor()

int GetDivisor ( int index)

Gets the divisor for the tick rate at the specified index.

Parameters
indexThe index of the tick rate to get the divisor for.
Returns
The divisor for the tick rate at the specified index.
Exceptions
ArgumentOutOfRangeExceptionThrown when the index is out of range.
InvalidOperationExceptionThrown when the client tick rate is not divisible by the tick rate at the specified index.

◆ GetTickRate()

int GetTickRate ( int index)

Gets the tick rate at the specified index.

Parameters
indexThe index of the tick rate to get.
Returns
The tick rate at the specified index.
Exceptions
ArgumentOutOfRangeExceptionThrown when the index is out of range.

◆ IsValid() [1/2]

bool IsValid ( int rate)
static

Checks if the provided tick rate is valid.

Parameters
rateThe tick rate to validate.
Returns
true if the tick rate is valid; otherwise, false.

◆ IsValid() [2/2]

bool IsValid ( TickRate rate)
static

Checks if the provided TickRate is valid.

Parameters
rateThe TickRate to validate.
Returns
true if the TickRate is valid; otherwise, false.

◆ Resolve()

Resolved Resolve ( Selection selection)
static

Resolves the specified Selection into a Resolved structure.

Parameters
selectionThe Selection to resolve.
Returns
A Resolved structure that represents the resolved tick rates.

◆ ToArray()

int[] ToArray ( )

Converts the tick rates to an array.

Returns
An array containing the tick rates.

◆ ValidateSelection()

ValidateResult ValidateSelection ( Selection selected)

Validates the tick rates in the specified Selection.

Parameters
selectedThe Selection to validate.
Returns
A ValidateResult that indicates the result of the validation.

The Selection is valid if:

  • The client tick rate is within the valid range.
  • The server tick interval in the Selection is a divisor of the client tick rate and is within the range of available intervals.
  • The server send interval in the Selection is a divisor of the client tick rate and is within the range of available intervals.
  • The client send interval in the Selection is a divisor of the client tick rate and is within the range of available intervals.
  • The server send interval in the Selection is not smaller than the server tick interval.

Property Documentation

◆ this[int index]

int this[int index]
get

Gets the tick rate at the specified index.

Parameters
indexThe index of the tick rate to get.
Returns
The tick rate at the specified index.