C# Класс 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.
Наследование: MonoBehaviour
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
BreakDuration int
TurnDuration int

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
StartRoundNow ( ) : void

Описание методов

OnJoinedRoom() публичный Метод

Called by PUN when this client entered a room (no matter if joined or created).
public OnJoinedRoom ( ) : void
Результат void

OnMasterClientSwitched() публичный Метод

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,
Результат void

OnPhotonCustomRoomPropertiesChanged() публичный Метод

Called by PUN when new properties for the room were set (by any client in the room).
public OnPhotonCustomRoomPropertiesChanged ( Hashtable, propertiesThatChanged ) : void
propertiesThatChanged Hashtable,
Результат void

Start() публичный Метод

public Start ( ) : void
Результат void

Update() публичный Метод

public Update ( ) : void
Результат void

Описание свойств

BreakDuration публичное свойство

public int BreakDuration
Результат int

TurnDuration публичное свойство

public int TurnDuration
Результат int