quantum-space-buddies/QSB/Messaging/PlayerStateMessage.cs

28 lines
774 B
C#
Raw Normal View History

2020-08-09 11:11:45 +02:00
using UnityEngine.Networking;
2020-08-09 12:40:35 +01:00
namespace QSB.Messaging
{
2020-08-09 21:46:51 +01:00
public class PlayerStateMessage : PlayerMessage
{
public string PlayerName { get; set; }
2020-08-10 11:45:24 +01:00
public bool PlayerReady { get; set; }
2020-08-09 21:46:51 +01:00
public State PlayerState { get; set; }
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
PlayerName = reader.ReadString();
2020-08-10 11:45:24 +01:00
PlayerReady = reader.ReadBoolean();
2020-08-09 21:46:51 +01:00
PlayerState = (State)reader.ReadInt32();
}
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(PlayerName);
2020-08-10 11:45:24 +01:00
writer.Write(PlayerReady);
2020-08-09 21:46:51 +01:00
writer.Write((int)PlayerState);
}
}
}