Пример #1
0
            public MCI(byte[] packet)
            {
                numOfPlayers = pakGetByte(packet, 3);
                int offsetStartPlayer = 4;
                int lengthPlayer      = 28;

                for (int i = 0; i < System.Math.Min(8, numOfPlayers); i++)
                {
                    compCar[i] = new DefCompCar();

                    compCar[i].node = pakGetWord(packet, offsetStartPlayer + i * lengthPlayer + 0);
                    compCar[i].lap  = pakGetWord(packet, offsetStartPlayer + i * lengthPlayer + 2);

                    compCar[i].PLID      = pakGetByte(packet, offsetStartPlayer + i * lengthPlayer + 4);
                    compCar[i].x         = pakGetInt(packet, offsetStartPlayer + i * lengthPlayer + 8);
                    compCar[i].y         = pakGetInt(packet, offsetStartPlayer + i * lengthPlayer + 12);
                    compCar[i].z         = pakGetInt(packet, offsetStartPlayer + i * lengthPlayer + 16);
                    compCar[i].speed     = pakGetWord(packet, offsetStartPlayer + i * lengthPlayer + 20);
                    compCar[i].direction = pakGetWord(packet, offsetStartPlayer + i * lengthPlayer + 22);
                    compCar[i].heading   = pakGetWord(packet, offsetStartPlayer + i * lengthPlayer + 24);
                    compCar[i].angvel    = pakGetShort(packet, offsetStartPlayer + i * lengthPlayer + 26);
//                    System.Console.WriteLine("ID:{0} x:{1} y:{2} z:{3} speed:{4} direction:{5} heading:{6} angvel:{7}", PLID, x, y, z, speed, direction, heading, angvel);

//                    if(debug)System.Console.WriteLine("{0:F2}m {1:F2}m {2:F2}m {3:F2}km/h {4:F2} {5:F2} {6:F2}", xm, ym, zm, spm, dirm, headm, angm);
                }
            }
Пример #2
0
            public MCI(byte[] packet)
            {
                numOfPlayers = pakGetByte( packet, 3 );
                int offsetStartPlayer = 4;
                int lengthPlayer = 28;

                for (int i = 0; i < System.Math.Min(8,numOfPlayers); i++)
                {
                    compCar[i] = new DefCompCar();

                    compCar[i].node =pakGetWord(packet, offsetStartPlayer + i * lengthPlayer + 0);
                    compCar[i].lap = pakGetWord(packet, offsetStartPlayer + i * lengthPlayer + 2);

                    compCar[i].PLID = pakGetByte( packet, offsetStartPlayer + i * lengthPlayer + 4 );
                    compCar[i].x = pakGetInt( packet, offsetStartPlayer + i * lengthPlayer + 8);
                    compCar[i].y = pakGetInt( packet, offsetStartPlayer + i * lengthPlayer + 12);
                    compCar[i].z = pakGetInt( packet, offsetStartPlayer + i * lengthPlayer + 16);
                    compCar[i].speed = pakGetWord( packet, offsetStartPlayer + i * lengthPlayer + 20);
                    compCar[i].direction = pakGetWord( packet, offsetStartPlayer + i * lengthPlayer + 22);
                    compCar[i].heading = pakGetWord( packet, offsetStartPlayer + i * lengthPlayer + 24);
                    compCar[i].angvel = pakGetShort(packet, offsetStartPlayer + i * lengthPlayer + 26);
//                    System.Console.WriteLine("ID:{0} x:{1} y:{2} z:{3} speed:{4} direction:{5} heading:{6} angvel:{7}", PLID, x, y, z, speed, direction, heading, angvel);
                   
//                    if(debug)System.Console.WriteLine("{0:F2}m {1:F2}m {2:F2}m {3:F2}km/h {4:F2} {5:F2} {6:F2}", xm, ym, zm, spm, dirm, headm, angm);
                }
            }