Photon Fusion 2.0.3

Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
TickTimer Struct Reference

A timer that is based on ticks instead of seconds. More...

Inherits INetworkStruct.

Public Member Functions

bool Expired (NetworkRunner runner)
 Checks if the TickTimer has expired. More...
 
bool ExpiredOrNotRunning (NetworkRunner runner)
 Checks if the TickTimer has expired or is not running. More...
 
int? RemainingTicks (NetworkRunner runner)
 Gets the number of remaining ticks until the TickTimer expires. More...
 
float? RemainingTime (NetworkRunner runner)
 Gets the remaining time in seconds until the TickTimer expires. More...
 
override string ToString ()
 Returns a string that represents the current TickTimer. More...
 

Static Public Member Functions

static TickTimer CreateFromSeconds (NetworkRunner runner, float delayInSeconds)
 Creates a TickTimer from a specified delay in seconds. More...
 
static TickTimer CreateFromTicks (NetworkRunner runner, int ticks)
 Creates a TickTimer from a specified number of ticks. More...
 

Public Attributes

int _target
 

Properties

bool IsRunning [get]
 Gets a value indicating whether the TickTimer is running. More...
 
static TickTimer None [get]
 Gets a TickTimer that is not running. More...
 
int? TargetTick [get]
 Gets the target tick of the TickTimer. More...
 

Detailed Description

A timer that is based on ticks instead of seconds.

Member Function Documentation

◆ CreateFromSeconds()

static TickTimer CreateFromSeconds ( NetworkRunner  runner,
float  delayInSeconds 
)
static

Creates a TickTimer from a specified delay in seconds.

Parameters
runnerThe NetworkRunner associated with the TickTimer.
delayInSecondsThe delay in seconds to set the TickTimer to.
Returns
A TickTimer that will expire after the specified delay in seconds. If the NetworkRunner is not alive or not running, returns a default TickTimer.

◆ CreateFromTicks()

static TickTimer CreateFromTicks ( NetworkRunner  runner,
int  ticks 
)
static

Creates a TickTimer from a specified number of ticks.

Parameters
runnerThe NetworkRunner associated with the TickTimer.
ticksThe number of ticks to set the TickTimer to.
Returns
A TickTimer that will expire after the specified number of ticks. If the NetworkRunner is not alive or not running, returns a default TickTimer.

◆ Expired()

bool Expired ( NetworkRunner  runner)

Checks if the TickTimer has expired.

Parameters
runnerThe NetworkRunner associated with the TickTimer.
Returns
true if the TickTimer is alive, the runner is running, and the target tick has been reached or passed; otherwise, false.

◆ ExpiredOrNotRunning()

bool ExpiredOrNotRunning ( NetworkRunner  runner)

Checks if the TickTimer has expired or is not running.

Parameters
runnerThe NetworkRunner associated with the TickTimer.
Returns
true if the TickTimer is not running, the runner is not running, or the TickTimer has expired; otherwise, false.

◆ RemainingTicks()

int? RemainingTicks ( NetworkRunner  runner)

Gets the number of remaining ticks until the TickTimer expires.

Parameters
runnerThe NetworkRunner associated with the TickTimer.
Returns
The number of remaining ticks if the TickTimer is alive and running; otherwise, null.

◆ RemainingTime()

float? RemainingTime ( NetworkRunner  runner)

Gets the remaining time in seconds until the TickTimer expires.

Parameters
runnerThe NetworkRunner associated with the TickTimer.
Returns
The remaining time in seconds if there are remaining ticks; otherwise, null.

◆ ToString()

override string ToString ( )

Returns a string that represents the current TickTimer.

Returns
A string that represents the current TickTimer.

Property Documentation

◆ IsRunning

bool IsRunning
get

Gets a value indicating whether the TickTimer is running.

true if the TickTimer is running; otherwise, false.

◆ None

TickTimer None
staticget

Gets a TickTimer that is not running.

◆ TargetTick

int? TargetTick
get

Gets the target tick of the TickTimer.

The target tick if the TickTimer is running; otherwise, null.