Exemplo n.º 1
0
            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);
                }
            }
Exemplo n.º 2
0
            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);
                }
            }
Exemplo n.º 3
0
            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);
                }
            }
Exemplo n.º 4
0
            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();
                    }
                }
            }
Exemplo n.º 5
0
 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();
     }
 }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 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);
 }
Exemplo n.º 8
0
            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);
            }