Пример #1
0
 public static void Turn(Robot robot, int direction, int velocity)
 {
     var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     var sendBuffer = Encoding.ASCII.GetBytes(String.Format("turn {0} {1}", direction, velocity));
     socket.SendTo(sendBuffer, robot.EndPoint);
 }
 private void CreateBodies()
 {
     _bodies = new Body[_canvas.Pieces.Length];
     _scaleses = new ScaleState[_canvas.Pieces.Length];
     _elementsContacts = new Dictionary<int, Contact>[_canvas.Pieces.Length];
     _robots = new Robot[_canvas.Pieces.Length];
     for (int i = 0; i < _canvas.Pieces.Length; ++i)
         _bodies[i] = CreateBody(_canvas.Pieces[i]);
     _robots[0] = new Robot("192.168.0.180");
     _timer.IsRunning = true;
 }
Пример #3
0
 public static void Stop(Robot robot)
 {
     var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     var sendBuffer = Encoding.ASCII.GetBytes("move 0 0");
     socket.SendTo(sendBuffer, robot.EndPoint);
 }