public void StartPacket(MyBitStream stream) { byte[] message = new byte[stream.BufferLength() + GnetBase.HeaderSize]; Buffer.BlockCopy(stream.GetUnderlyingArray(), 0, message, GnetBase.HeaderSize, stream.BufferLength()); Buffer.BlockCopy(BitConverter.GetBytes(GnetBase.PROTOCOL_ID), 0, message, 0, 4); Buffer.BlockCopy(BitConverter.GetBytes(PacketNumber), 0, message, 4, 4); }
public byte[] Pack() { MyBitStream stream = new MyBitStream(Size); stream.PackBool(A); stream.PackBool(B); stream.PackBool(X); stream.PackBool(Y); stream.PackBool(Select); stream.PackBool(Start); stream.PackBool(LB); stream.PackBool(RB); stream.PackBool(Left); stream.PackBool(Right); stream.PackBool(Up); stream.PackBool(Down); stream.PackBool(LeftStick); stream.PackBool(RightStick); stream.PackBool(false); stream.PackBool(false); stream.PackFloat(LeftAxisVertical); stream.PackFloat(LeftAxisHorizontal); stream.PackFloat(RightAxisVertical); stream.PackFloat(RightAxisHorizontal); stream.PackFloat(LT); stream.PackFloat(RT); return(stream.GetUnderlyingArray()); }
public byte[] Pack() { MyBitStream stream = new MyBitStream(PackedSize);; stream.PackVector3(transform.position); stream.PackQuaternion(transform.rotation); stream.PackVector3(_velocity); return(stream.GetUnderlyingArray()); }