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

36 lines
839 B
C#
Raw Normal View History

using QuantumUNET.Transport;
2020-12-16 08:57:15 +00:00
using UnityEngine.Networking;
2020-12-15 16:37:52 +00:00
namespace QuantumUNET.Messages
2020-11-08 14:41:16 +00:00
{
2020-12-04 09:23:27 +00:00
internal class QSBAnimationMessage : QSBMessageBase
2020-12-02 21:23:01 +00:00
{
2020-12-16 08:57:15 +00:00
public NetworkInstanceId 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-04 09:23:27 +00:00
public override void Serialize(QSBNetworkWriter writer)
2020-12-02 21:23:01 +00:00
{
writer.Write(netId);
writer.WritePackedUInt32((uint)stateHash);
writer.Write(normalizedTime);
if (parameters == null)
{
writer.WriteBytesAndSize(parameters, 0);
}
else
{
writer.WriteBytesAndSize(parameters, parameters.Length);
}
}
public override void Deserialize(QSBNetworkReader 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
}