private static void OnSetTimer(MySyncTimerBlock sync, ref SetTimerMsg msg, MyNetworkClient sender) { sync.m_timer.SetTimer(msg.Time); if (Sync.IsServer) { Sync.Layer.SendMessageToAll(ref msg); } }
public void SetTimer(int p) { var msg = new SetTimerMsg(); msg.EntityId = m_timer.EntityId; msg.Time = p; Sync.Layer.SendMessageToServer(ref msg); m_timer.SetTimer(p); }
static void SetTimerSuccess(ref SetTimerMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) { warhead.m_countdownMs = msg.TimerMs; warhead.RaisePropertiesChanged(); } }
static void SetTimerRequest(ref SetTimerMsg msg, MyNetworkClient sender) { Debug.Assert(Sync.IsServer); MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) { Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success); } }
public static void SyncClientTimers(MyWarhead warhead) { Debug.Assert(Sync.IsServer); if (!Sync.IsServer) { return; } SetTimerMsg msg = new SetTimerMsg(); msg.EntityId = warhead.EntityId; msg.TimerMs = warhead.m_countdownMs; Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); }
public static void SetTimer(MyWarhead warhead, float newTimerValue) { SetTimerMsg msg = new SetTimerMsg(); msg.EntityId = warhead.EntityId; msg.TimerMs = (int)newTimerValue; if (Sync.IsServer) { Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success); } else { Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); } }
static void SetTimerSuccess(ref SetTimerMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) { warhead.m_countdownMs = msg.TimerMs; warhead.RaisePropertiesChanged(); } }
static void SetTimerRequest(ref SetTimerMsg msg, MyNetworkClient sender) { Debug.Assert(Sync.IsServer); MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success); }
public static void SyncClientTimers(MyWarhead warhead) { Debug.Assert(Sync.IsServer); if (!Sync.IsServer) return; SetTimerMsg msg = new SetTimerMsg(); msg.EntityId = warhead.EntityId; msg.TimerMs = warhead.m_countdownMs; Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); }
public static void SetTimer(MyWarhead warhead, float newTimerValue) { SetTimerMsg msg = new SetTimerMsg(); msg.EntityId = warhead.EntityId; msg.TimerMs = (int)newTimerValue; if (Sync.IsServer) Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success); else Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
private static void OnSetTimer(MySyncTimerBlock sync, ref SetTimerMsg msg, MyNetworkClient sender) { sync.m_timer.SetTimer(msg.Time); if (Sync.IsServer) Sync.Layer.SendMessageToAll(ref msg); }
public void SetTimer(int p) { var msg = new SetTimerMsg(); msg.EntityId = m_timer.EntityId; msg.Time = p; Sync.Layer.SendMessageToServer(ref msg); m_timer.SetTimer(p); }