コード例 #1
0
 void SyncFrame()
 {
     if (_isOwner && _listener.FramesToSend.Count > 0)
     {
         // The player sends the frames he played to the server.
         networkObject.SendRpc(RPC_SYNC_INPUTS, Receivers.Server, _listener.DequeueFramesToSend());
     }
     else if (networkObject.IsServer && _listener.LocalInputHistory.Count > 0)
     {
         // The server sends back what he played to the controlling player.
         networkObject.SendRpcUnreliable(_owningPlayer, RPC_SYNC_INPUT_HISTORY, _listener.DequeueLocalInputHistory());
     }
 }