2024-02-02 12:39:04 +03:00
|
|
|
using LiteNetLib;
|
|
|
|
using LiteNetLib.Utils;
|
2024-02-09 10:00:36 +03:00
|
|
|
|
2024-02-02 12:39:04 +03:00
|
|
|
using Syntriax.Engine.Core;
|
|
|
|
|
2024-02-09 10:00:36 +03:00
|
|
|
namespace Syntriax.Engine.Network;
|
2024-02-02 12:39:04 +03:00
|
|
|
|
|
|
|
public static class NetworkExtensions
|
|
|
|
{
|
|
|
|
public static Vector2D GetVector2D(this NetPacketReader reader)
|
|
|
|
=> new(reader.GetFloat(), reader.GetFloat());
|
2024-07-14 23:55:06 +03:00
|
|
|
public static void GetVector2D(this NetPacketReader reader, out Vector2D vector2D)
|
|
|
|
=> vector2D = new(reader.GetFloat(), reader.GetFloat());
|
2024-02-02 12:39:04 +03:00
|
|
|
|
|
|
|
public static void Put(this NetDataWriter writer, Vector2D vector)
|
|
|
|
{
|
|
|
|
writer.Put(vector.X);
|
|
|
|
writer.Put(vector.Y);
|
|
|
|
}
|
|
|
|
}
|