private Packet DecodePacket(PacketWrapper packetWrapper, ref int iReadHead) { //get packet type Packet.PacketType ptyPacketType = Packet.GetPacketType(packetWrapper, iReadHead); Packet pktOutput = null; //create Packet switch (ptyPacketType) { case Packet.PacketType.Ping: pktOutput = new PingPacket(); break; case Packet.PacketType.Input: pktOutput = new InputPacket(); break; case Packet.PacketType.ResetTickCount: pktOutput = new ResetTickCountPacket(); break; case Packet.PacketType.StartCountdown: pktOutput = new StartCountDownPacket(); break; } //decode packet iReadHead = pktOutput.DecodePacket(packetWrapper, iReadHead); return(pktOutput); }
private void CompareTickPakets(InputPacket pktPacket) { int iTickForPacket = 0; if (m_dicInputCompare.TryGetValue(pktPacket.m_bInput, out iTickForPacket)) { if (iTickForPacket != pktPacket.m_iTick) { Debug.Log("Tick Missmatch for input " + pktPacket.m_bInput + " Correct Tick:" + iTickForPacket + " Decoded Tick:" + pktPacket.m_iTick); } } }