quantum-space-buddies/QuantumUNET/Messages/QAnimationMessage.cs

28 lines
707 B
C#
Raw Normal View History

using QuantumUNET.Transport;
2020-12-15 16:37:52 +00:00
namespace QuantumUNET.Messages
2020-11-08 14:41:16 +00:00
{
2020-12-23 12:58:45 +00:00
internal class QAnimationMessage : QMessageBase
2020-12-02 21:23:01 +00:00
{
2021-12-03 03:41:19 +00:00
public QNetworkInstanceId netId;
2020-12-02 21:23:01 +00:00
public int stateHash;
public float normalizedTime;
public byte[] parameters;
2020-11-08 14:41:16 +00:00
2020-12-23 12:58:45 +00:00
public override void Serialize(QNetworkWriter writer)
2020-12-02 21:23:01 +00:00
{
writer.Write(netId);
writer.WritePackedUInt32((uint)stateHash);
writer.Write(normalizedTime);
writer.WriteBytesAndSize(parameters, parameters?.Length ?? 0);
2020-12-02 21:23:01 +00:00
}
2020-12-23 12:58:45 +00:00
public override void Deserialize(QNetworkReader reader)
{
netId = reader.ReadNetworkId();
stateHash = (int)reader.ReadPackedUInt32();
normalizedTime = reader.ReadSingle();
parameters = reader.ReadBytesAndSize();
}
2020-12-02 21:23:01 +00:00
}
2020-11-08 16:13:10 +00:00
}