quakeball/Assets/Scripts/Networking/Packets/PlayerActionPckt.cs

35 lines
873 B
C#
Raw Normal View History

2020-08-08 03:21:02 +02:00
using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Networking.Packets {
public class PlayerActionPckt : Packet {
public ulong PlayerId;
public PlayerAction Action;
public PlayerActionPckt() { }
public PlayerActionPckt(PlayerAction action, ulong id = 0) {
Action = action;
PlayerId = id;
}
public override void Read(ByteBuffer buffer) {
PlayerId = buffer.ReadULong();
switch (buffer.Read()) {
case 0:
Action = PlayerAction.Jump;
break;
}
}
public override void Write(ByteBuffer buffer) {
buffer.Write(PlayerId);
buffer.Write((byte)Action);
}
}
public enum PlayerAction {
Null = byte.MaxValue,
Jump = 0,
}
}