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

29 lines
652 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 QSBObjectSpawnSceneMessage : MessageBase
2020-12-02 12:42:26 +00:00
{
2020-12-03 11:56:32 +00:00
public NetworkInstanceId NetId;
public NetworkSceneId SceneId;
public Vector3 Position;
public byte[] Payload;
2020-12-02 12:42:26 +00:00
public override void Deserialize(NetworkReader reader)
{
2020-12-03 11:56:32 +00:00
NetId = reader.ReadNetworkId();
SceneId = reader.ReadSceneId();
Position = reader.ReadVector3();
Payload = reader.ReadBytesAndSize();
2020-12-02 12:42:26 +00:00
}
public override void Serialize(NetworkWriter writer)
{
2020-12-03 11:56:32 +00:00
writer.Write(NetId);
writer.Write(SceneId);
writer.Write(Position);
writer.WriteBytesFull(Payload);
2020-12-02 12:42:26 +00:00
}
}
2020-12-03 08:28:05 +00:00
}