quantum-space-buddies/QuantumUNET/Messages/QAnimationMessage.cs
2020-12-23 12:58:45 +00:00

29 lines
736 B
C#

using QuantumUNET.Transport;
using UnityEngine.Networking;
namespace QuantumUNET.Messages
{
internal class QAnimationMessage : QMessageBase
{
public NetworkInstanceId netId;
public int stateHash;
public float normalizedTime;
public byte[] parameters;
public override void Serialize(QNetworkWriter writer)
{
writer.Write(netId);
writer.WritePackedUInt32((uint)stateHash);
writer.Write(normalizedTime);
writer.WriteBytesAndSize(parameters, parameters?.Length ?? 0);
}
public override void Deserialize(QNetworkReader reader)
{
netId = reader.ReadNetworkId();
stateHash = (int)reader.ReadPackedUInt32();
normalizedTime = reader.ReadSingle();
parameters = reader.ReadBytesAndSize();
}
}
}