From 97a6b74417cab0e21bb0d3e3583db9d803ce4189 Mon Sep 17 00:00:00 2001 From: teascade Date: Sat, 8 Aug 2020 04:53:38 +0300 Subject: [PATCH] Add ShootData --- .../Networking/Packets/PlayerActionPckt.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Assets/Scripts/Networking/Packets/PlayerActionPckt.cs b/Assets/Scripts/Networking/Packets/PlayerActionPckt.cs index 98dac52..6fbba79 100644 --- a/Assets/Scripts/Networking/Packets/PlayerActionPckt.cs +++ b/Assets/Scripts/Networking/Packets/PlayerActionPckt.cs @@ -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) { + } } } \ No newline at end of file