예제 #1
0
 /// <summary>
 /// Send rpc to server
 /// </summary>
 public void SendRPC
 (
     byte packet_id,
     PacketPriority priority       = PacketPriority.IMMEDIATE_PRIORITY,
     PacketReliability reliability = PacketReliability.RELIABLE,
     NetChannel channel            = NetChannel.NET_EVENTS
 )
 {
     if (IsConnected)
     {
         client_peer?.BeginWrite();
         client_peer?.Write(packet_id);
         client_peer?.SendToServer(priority, reliability, channel);
     }
     else
     {
         if (RakNet_Peer.debugLevel >= RakDebugLevel.Low)
         {
             Debug.LogError("[Client] Is not connected!");
         }
     }
 }
 protected void Write(bool s)
 {
     if (_receiving)
     {
         Debug.Log(GetType() + " unable to write packet! He is received!");
         return;
     }
     peer?.Write(s);
     _sz += 1;
 }
 /// <summary>
 /// Send rpc to client
 /// </summary>
 public void SendRPC
 (
     byte packet_id,
     ulong guid,
     PacketPriority priority       = PacketPriority.IMMEDIATE_PRIORITY,
     PacketReliability reliability = PacketReliability.RELIABLE,
     NetChannel channel            = NetChannel.NET_EVENTS
 )
 {
     server_peer?.BeginWrite();
     server_peer?.Write(packet_id);
     server_peer?.SendToClient(guid, priority, reliability, channel);
 }