feat: NetworkExtensions for Vector2D Communication
This commit is contained in:
parent
ef8b04648c
commit
78010c266e
|
@ -0,0 +1,17 @@
|
|||
using LiteNetLib;
|
||||
using LiteNetLib.Utils;
|
||||
using Syntriax.Engine.Core;
|
||||
|
||||
namespace Pong.Network;
|
||||
|
||||
public static class NetworkExtensions
|
||||
{
|
||||
public static Vector2D GetVector2D(this NetPacketReader reader)
|
||||
=> new(reader.GetFloat(), reader.GetFloat());
|
||||
|
||||
public static void Put(this NetDataWriter writer, Vector2D vector)
|
||||
{
|
||||
writer.Put(vector.X);
|
||||
writer.Put(vector.Y);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue