Initial progress syncing + many existing bugs
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Marro.PacManUdon
|
||||
FullSyncForced = 0,
|
||||
FullSync = 1,
|
||||
PacManTurn = 2,
|
||||
StartGameButtonPressed = 3,
|
||||
}
|
||||
|
||||
public class NetworkManager : UdonSharpBehaviour
|
||||
@@ -217,7 +218,12 @@ namespace Marro.PacManUdon
|
||||
|
||||
syncedObjects = root.GetComponentsInChildren<SyncedObject>(includeInactive: true);
|
||||
|
||||
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) 3 Found {syncedObjects.Length} {nameof(SyncedObject)} in children of {root.name}.");
|
||||
foreach (var obj in syncedObjects)
|
||||
{
|
||||
obj.networkManager = this;
|
||||
}
|
||||
|
||||
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Found {syncedObjects.Length} {nameof(SyncedObject)} in children of {root.name}.");
|
||||
|
||||
SetOwner(Networking.IsOwner(gameObject));
|
||||
|
||||
@@ -239,6 +245,11 @@ namespace Marro.PacManUdon
|
||||
|
||||
public void FixedUpdate()
|
||||
{
|
||||
if (!Ready)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch the current time
|
||||
UpdateInternalTime();
|
||||
|
||||
@@ -268,14 +279,14 @@ namespace Marro.PacManUdon
|
||||
IsEventUpdate = false;
|
||||
ProgressSyncedTime(internalTime);
|
||||
|
||||
Debug.Log($"{nameof(PacManUdon)} {nameof(NetworkManager)} syncedObjects: {syncedObjects}");
|
||||
Debug.Log($"{nameof(PacManUdon)} {nameof(NetworkManager)} Starting SyncedUpdate for {syncedObjects.Length} objects.");
|
||||
|
||||
for (int i = 0; i < syncedObjects.Length; i++)
|
||||
{
|
||||
var obj = syncedObjects[i];
|
||||
Debug.Log($"{nameof(PacManUdon)} {nameof(NetworkManager)} SyncedUpdate for {obj.gameObject.name}");
|
||||
obj.SyncedUpdate();
|
||||
|
||||
if (obj.gameObject.activeInHierarchy)
|
||||
{
|
||||
obj.SyncedUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +378,7 @@ namespace Marro.PacManUdon
|
||||
|
||||
QueueEventInBuffer(result);
|
||||
|
||||
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Prepared event with {eventSize} bytes and timestamp {timestamp} for serialization, index is now {this.eventsQueueIndex}");
|
||||
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Prepared event of type {eventType} with {eventSize} bytes, timestamp {timestamp} and id {eventId} for serialization.");
|
||||
|
||||
RequestSerializationForEvents();
|
||||
|
||||
@@ -905,6 +916,11 @@ namespace Marro.PacManUdon
|
||||
/// An animator which visualizes whether the current perspective is the owner.
|
||||
/// </summary>
|
||||
[SerializeField] private Animator DebugImageToIndicateOwner;
|
||||
|
||||
public void DoFullSync()
|
||||
{
|
||||
SendEvent(NetworkEventType.FullSync);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user