Successful sync test

This commit is contained in:
2026-01-01 20:44:34 +01:00
parent 97fe8cd69f
commit 69a0a752be
19 changed files with 3173 additions and 740 deletions

View File

@@ -2,7 +2,6 @@
namespace Marro.PacManUdon
{
using Assets.Scripts;
using System;
using UdonSharp;
using UnityEngine;
@@ -78,7 +77,7 @@ namespace Marro.PacManUdon
playerInput.Initialize(this);
soundManager.Initialize();
intermission2Pole.Initialize(this, ghostManager.Ghosts[0]);
networkManager.Initialize(Networking.IsOwner(gameObject));
networkManager.Initialize();
HideEverything();
@@ -423,7 +422,7 @@ namespace Marro.PacManUdon
ghostManager.SetOwner(Networking.LocalPlayer);
}
public override void AppendSyncedData(byte[][] data, ref int offset)
public override void AppendSyncedData(byte[][] data, ref int offset, NetworkEventType eventType, uint eventTime)
{
data[offset++] = new byte[] { Int32ToByte((int)gameState) };
data[offset++] = BitConverter.GetBytes(currentlyInTimeSequence);
@@ -431,7 +430,7 @@ namespace Marro.PacManUdon
data[offset++] = BitConverter.GetBytes(timeSequenceProgress);
}
public override bool SetSyncedData(byte[] data, ref int offset)
public override bool SetSyncedData(byte[] data, ref int offset, NetworkEventType eventType, uint eventTime)
{
SetGameState((PacManGameState)data[offset++]);
@@ -444,6 +443,11 @@ namespace Marro.PacManUdon
return true;
}
public override void SyncedToNewTime(uint oldTime, uint newTime)
{
}
public int ExtraLives
{
set
@@ -499,6 +503,7 @@ namespace Marro.PacManUdon
}
public static byte Int32ToByte(int value) =>
byte.Parse(value.ToString()); // This is the only way I could find to cast an int to byte in Udon, a regular cast crashes in runtime...
(byte)value;
//byte.Parse(value.ToString()); // This is the only way I could find to cast an int to byte in Udon, a regular cast crashes in runtime...
}
}