Initial progress syncing + many existing bugs
This commit is contained in:
@@ -34,6 +34,11 @@ namespace Marro.PacManUdon
|
||||
|
||||
public override void AppendSyncedData(byte[][] data, ref int offset, NetworkEventType eventType)
|
||||
{
|
||||
if (eventType != NetworkEventType.PacManTurn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var position = GetPosition();
|
||||
data[offset++] = BitConverter.GetBytes(position.x);
|
||||
data[offset++] = BitConverter.GetBytes(position.y);
|
||||
@@ -45,9 +50,14 @@ namespace Marro.PacManUdon
|
||||
|
||||
public override bool SetSyncedData(byte[] data, ref int offset, NetworkEventType eventType)
|
||||
{
|
||||
SetPosition(new Vector2(BitConverter.ToSingle(data, offset), BitConverter.ToSingle(data, offset + 2)));
|
||||
SetDirection(new Vector2(BitConverter.ToSingle(data, offset + 4), BitConverter.ToSingle(data, offset + 6)));
|
||||
offset += 8;
|
||||
if (eventType != NetworkEventType.PacManTurn)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SetPosition(new Vector2(BitConverter.ToSingle(data, offset), BitConverter.ToSingle(data, offset + 4)));
|
||||
SetDirection(new Vector2(BitConverter.ToSingle(data, offset + 8), BitConverter.ToSingle(data, offset + 12)));
|
||||
offset += 16;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user