Advertisement
baflink

URPC_Message_Delay_30.cs

Jul 7th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. namespace BeardedManStudios.Forge.Examples
  2. {
  3.     public class URPC_Message_Delay_30 : NetworkedMonoBehavior
  4.     {
  5.         private float interval = 0.0f;
  6.         private void Update()
  7.         {
  8.             if (OwningNetWorker.IsServer)
  9.             {
  10.                 interval += Time.deltaTime;
  11.  
  12.                 if (interval > 0.1f)
  13.                 {
  14.                     URPC("UpdateTime", NetworkReceivers.Others, NetworkingManager.Instance.ServerTime);
  15.                     Debug.Log("UpdateTime: " + NetworkingManager.Instance.SimulatedServerTime);
  16.                     interval = 0.0f;
  17.                 }
  18.             }
  19.         }
  20.  
  21.         [BRPC]
  22.         private void UpdateTime(float time)
  23.         {
  24.             Debug.Log("UpdateTime: " + time);
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement