static void CountdownRequest(ref CountdownMsg msg, MyNetworkClient sender) { Debug.Assert(Sync.IsServer); MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) { SetCountdownServer(warhead, ref msg); } }
private static void SetCountdown(MyWarhead warhead, bool countdownState) { CountdownMsg msg = new CountdownMsg(); msg.EntityId = warhead.EntityId; msg.CountdownState = countdownState; if (Sync.IsServer) { SetCountdownServer(warhead, ref msg); } else { Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); } }
private static void SetCountdownServer(MyWarhead warhead, ref CountdownMsg msg) { bool success = false; if (msg.CountdownState) { success = warhead.StartCountdown(); } else { success = warhead.StopCountdown(); } if (success) { Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); } }
static void CountdownSuccess(ref CountdownMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) { if (msg.CountdownState) { warhead.StartCountdown(); } else { warhead.StopCountdown(); } } }
static void CountdownSuccess(ref CountdownMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) { if (msg.CountdownState) warhead.StartCountdown(); else warhead.StopCountdown(); } }
static void CountdownRequest(ref CountdownMsg msg, MyNetworkClient sender) { Debug.Assert(Sync.IsServer); MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); var warhead = entity as MyWarhead; if (warhead != null) SetCountdownServer(warhead, ref msg); }
private static void SetCountdownServer(MyWarhead warhead, ref CountdownMsg msg) { bool success = false; if (msg.CountdownState) success = warhead.StartCountdown(); else success = warhead.StopCountdown(); if (success) Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); }
private static void SetCountdown(MyWarhead warhead, bool countdownState) { CountdownMsg msg = new CountdownMsg(); msg.EntityId = warhead.EntityId; msg.CountdownState = countdownState; if (Sync.IsServer) { SetCountdownServer(warhead, ref msg); } else Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }