quantum-space-buddies/QSB/QuantumUNET/QSBObjectSpawnMessage.cs

40 lines
867 B
C#
Raw Normal View History

2020-12-02 21:23:01 +00:00
using UnityEngine;
2020-12-02 12:42:26 +00:00
using UnityEngine.Networking;
2020-12-02 21:19:10 +00:00
namespace QSB.QuantumUNET
2020-12-02 12:42:26 +00:00
{
2020-12-03 08:28:05 +00:00
internal class QSBObjectSpawnMessage : MessageBase
2020-12-02 12:42:26 +00:00
{
public override void Deserialize(NetworkReader reader)
{
netId = reader.ReadNetworkId();
assetId = reader.ReadNetworkHash128();
position = reader.ReadVector3();
payload = reader.ReadBytesAndSize();
uint num = 16U;
if ((long)reader.Length - (long)((ulong)reader.Position) >= (long)((ulong)num))
{
rotation = reader.ReadQuaternion();
}
}
public override void Serialize(NetworkWriter writer)
{
writer.Write(netId);
writer.Write(assetId);
writer.Write(position);
writer.WriteBytesFull(payload);
writer.Write(rotation);
}
public NetworkInstanceId netId;
public NetworkHash128 assetId;
public Vector3 position;
public byte[] payload;
public Quaternion rotation;
}
2020-12-03 08:28:05 +00:00
}