Expanded sync
This commit is contained in:
@@ -72,8 +72,6 @@ namespace Marro.PacManUdon
|
||||
|
||||
ghosts[ghostIndex].Initialize(collisionManager, pacMan, blinky, startTransform, homePosition, idlePosition1, idlePosition2, cornerPosition, ghostIndex);
|
||||
}
|
||||
|
||||
SubscribeToEvent(NetworkEventType.GhostUpdate);
|
||||
}
|
||||
|
||||
public void RestartLevel(bool afterLifeLost = false)
|
||||
@@ -456,11 +454,6 @@ namespace Marro.PacManUdon
|
||||
|
||||
public override void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType)
|
||||
{
|
||||
if (eventType != NetworkEventType.GhostUpdate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Power Pellet logic
|
||||
data.Append(powerPelletActive, ref index);
|
||||
data.Append(powerPelletCountdown, ref index);
|
||||
@@ -487,15 +480,15 @@ namespace Marro.PacManUdon
|
||||
data.Append(kinematic, ref index);
|
||||
|
||||
data.AppendAsByte(gameController.Level, ref index);
|
||||
|
||||
foreach (var ghost in ghosts)
|
||||
{
|
||||
ghost.CollectSyncedData(data, ref index, eventType);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType)
|
||||
{
|
||||
if (eventType != NetworkEventType.GhostUpdate)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Power Pellet logic
|
||||
powerPelletActive = data.ReadBool(ref index);
|
||||
powerPelletCountdown = data.ReadFloat(ref index);
|
||||
@@ -524,6 +517,11 @@ namespace Marro.PacManUdon
|
||||
var level = data.ReadByte(ref index);
|
||||
SetLevelConstants(level);
|
||||
|
||||
foreach (var ghost in ghosts)
|
||||
{
|
||||
ghost.WriteSyncedData(data, ref index, eventType);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user