feat: NetworkExtensions for Vector2D Communication

This commit is contained in:
Syntriax 2024-02-02 12:39:04 +03:00
parent ef8b04648c
commit 78010c266e
1 changed files with 17 additions and 0 deletions

View File

@ -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);
}
}