public static void WriteStopMarker(this BasePacket stream) { if (stream.CanWrite()) { stream.WriteBool(false); } }
public static void WriteEntity(this BasePacket packet, Entity entity) { if (packet.WriteBool((entity != null) && entity.IsAttached)) { packet.WriteNetworkId(entity.NetworkId); } }
public static void WriteContinueMarker(this BasePacket stream) { if (stream.CanWrite()) { stream.WriteBool(true); } }
public static void WriteByteArraySimple(this BasePacket stream, byte[] array, int maxLength) { if (stream.WriteBool(array != null)) { int length = Mathf.Min(array.Length, maxLength); if (length < array.Length) { NetLog.Warn("Only sending {0}/{1} bytes from byte array", length, array.Length); } stream.WriteUShort((ushort)length); stream.WriteByteArray(array, 0, length); } }