Ghosts synced with some issues

This commit is contained in:
2026-01-24 15:04:54 +01:00
parent 9554d1c512
commit 1433b9bdfc
11 changed files with 1489 additions and 1168 deletions

View File

@@ -85,7 +85,10 @@ namespace Marro.PacManUdon
private Vector2[] predefinedPath;
private int predefinedPathIndex;
public void Initialize(PacMan pacMan, Ghost blinky, Transform startTransform, Vector2 homePosition, Vector2 idlePosition1, Vector2 idlePosition2, Vector2 cornerPosition)
public bool IsScared => isScared;
public int Index { get; private set; }
public void Initialize(PacMan pacMan, Ghost blinky, Transform startTransform, Vector2 homePosition, Vector2 idlePosition1, Vector2 idlePosition2, Vector2 cornerPosition, int index)
{
ghostManager = transform.parent.GetComponent<GhostManager>();
animator = GetComponent<Animator>();
@@ -104,6 +107,8 @@ namespace Marro.PacManUdon
startRotation = startTransform.localRotation;
frozenState = PacManGhostFrozenState.Frozen;
Index = index;
}
public void Reset()
@@ -758,8 +763,6 @@ namespace Marro.PacManUdon
return ghostState;
}
public bool IsScared => isScared;
public void SetSpeed(float speed)
{
this.speed = speed;
@@ -780,15 +783,15 @@ namespace Marro.PacManUdon
data.Append(turnAroundSoon, ref index);
data.Append(speed, ref index);
data.Append((byte)ghostState, ref index);
data.AppendAsByte((int)ghostState, ref index);
data.Append(isScared, ref index);
data.Append(scattering, ref index);
data.Append((byte)frozenState, ref index);
data.AppendAsByte((int)frozenState, ref index);
data.Append(offGrid, ref index);
data.Append((byte)housePelletCounter, ref index);
data.AppendAsByte(housePelletCounter, ref index);
data.Append(housePelletCounterActive, ref index);
data.Append((byte)housePelletCounterLimit, ref index);
data.AppendAsByte(housePelletCounterLimit, ref index);
data.Append(faceInStartingDirectionUntilUnfrozen, ref index);
base.CollectSyncedData(data, ref index, eventType);
@@ -806,6 +809,7 @@ namespace Marro.PacManUdon
inTunnel = data.ReadBool(ref index);
rngState = data.ReadInt(ref index);
turnAroundSoon = data.ReadBool(ref index);
Debug.Log($"{gameObject} turnAroundSoon = {turnAroundSoon}");
speed = data.ReadFloat(ref index);
ghostState = (PacManGhostState)data.ReadByte(ref index);