Add ShootData

This commit is contained in:
Sofia 2020-08-08 04:53:38 +03:00
parent afaed03bd5
commit 97a6b74417

View File

@ -6,6 +6,7 @@ namespace NeonTea.Quakeball.Networking.Packets {
public ulong PlayerId; public ulong PlayerId;
public PlayerAction Action; public PlayerAction Action;
public Serializable Serializable;
public PlayerActionPckt() { } public PlayerActionPckt() { }
public PlayerActionPckt(PlayerAction action, ulong id = 0) { public PlayerActionPckt(PlayerAction action, ulong id = 0) {
@ -19,17 +20,35 @@ namespace NeonTea.Quakeball.Networking.Packets {
case 0: case 0:
Action = PlayerAction.Jump; Action = PlayerAction.Jump;
break; break;
case 1:
Action = PlayerAction.Shoot;
ShootData data = new ShootData();
data.Read(buffer);
Serializable = data;
break;
} }
} }
public override void Write(ByteBuffer buffer) { public override void Write(ByteBuffer buffer) {
buffer.Write(PlayerId); buffer.Write(PlayerId);
buffer.Write((byte)Action); buffer.Write((byte)Action);
if (Action == PlayerAction.Shoot) {
buffer.Write(Serializable);
}
} }
} }
public enum PlayerAction { public enum PlayerAction {
Null = byte.MaxValue, Null = byte.MaxValue,
Jump = 0, Jump = 0,
Shoot = 1,
}
public class ShootData : Serializable {
public void Read(ByteBuffer buffer) {
}
public void Write(ByteBuffer buffer) {
}
} }
} }