C# Class RaceTimer, KestrelFPV

Simple script that uses a property to sync a start time for a multiplayer game.
When entering a room, the first player will store the synchronized timestamp. You can't set the room's synchronized time in CreateRoom, because the clock on the Master Server and those on the Game Servers are not in sync. We use many servers and each has it's own timer. Everyone else will join the room and check the property to calculate how much time passed since start. You can start a new round whenever you like. Based on this, you should be able to implement a synchronized timer for turns between players.
Inheritance: MonoBehaviour
Afficher le fichier Open project: eleurent/KestrelFPV Class Usage Examples

Méthodes publiques

Свойство Type Description
BreakDuration int
TurnDuration int

Méthodes publiques

Méthode Description
OnJoinedRoom ( ) : void

Called by PUN when this client entered a room (no matter if joined or created).

OnMasterClientSwitched ( PhotonPlayer, newMasterClient ) : void In theory, the client which created the room might crash/close before it sets the start time. Just to make extremely sure this never happens, a new masterClient will check if it has to start a new round.
OnPhotonCustomRoomPropertiesChanged ( Hashtable, propertiesThatChanged ) : void

Called by PUN when new properties for the room were set (by any client in the room).

Start ( ) : void
Update ( ) : void

Private Methods

Méthode Description
StartRoundNow ( ) : void

Method Details

OnJoinedRoom() public méthode

Called by PUN when this client entered a room (no matter if joined or created).
public OnJoinedRoom ( ) : void
Résultat void

OnMasterClientSwitched() public méthode

In theory, the client which created the room might crash/close before it sets the start time. Just to make extremely sure this never happens, a new masterClient will check if it has to start a new round.
public OnMasterClientSwitched ( PhotonPlayer, newMasterClient ) : void
newMasterClient PhotonPlayer,
Résultat void

OnPhotonCustomRoomPropertiesChanged() public méthode

Called by PUN when new properties for the room were set (by any client in the room).
public OnPhotonCustomRoomPropertiesChanged ( Hashtable, propertiesThatChanged ) : void
propertiesThatChanged Hashtable,
Résultat void

Start() public méthode

public Start ( ) : void
Résultat void

Update() public méthode

public Update ( ) : void
Résultat void

Property Details

BreakDuration public_oe property

public int BreakDuration
Résultat int

TurnDuration public_oe property

public int TurnDuration
Résultat int