Add ShootData

This commit is contained in:
Sofia 2020-08-08 04:53:38 +03:00
parent afaed03bd5
commit 97a6b74417
1 changed files with 19 additions and 0 deletions

View File

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