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

34 lines
1.0 KiB
C#
Raw Normal View History

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