blob: 6cdd6b91fd81174a501dbedc82791074d6cd056d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
using System.Numerics;
using System.Threading.Tasks;
using Impostor.Api.Net.Inner.Objects.Components;
namespace Impostor.Server.Net.Inner.Objects.Components
{
internal partial class InnerCustomNetworkTransform : IInnerCustomNetworkTransform
{
public async ValueTask SnapToAsync(Vector2 position)
{
var minSid = (ushort)(_lastSequenceId + 5U);
// Snap in the server.
SnapTo(position, minSid);
// Broadcast to all clients.
using (var writer = _game.StartRpc(NetId, RpcCalls.SnapTo))
{
WriteVector2(writer, position);
writer.Write(_lastSequenceId);
await _game.FinishRpcAsync(writer);
}
}
}
}
|