Engine-Pong/Game/Network/NetworkExtensions.cs

18 lines
404 B
C#
Raw Normal View History

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