Working on ghost issues
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -163,14 +163,15 @@ namespace Marro.PacManUdon
|
||||
SetPosition(nextPosition);
|
||||
}
|
||||
|
||||
private Vector2 ProcessNextPosition(Vector2 position, Vector2 nextPosition)
|
||||
private Vector2 ProcessNextPosition(Vector2 position, Vector2 nextPosition)
|
||||
{
|
||||
if (turnAroundSoon && ghostState == PacManGhostState.Normal
|
||||
&& GridMoverTools.CrossesTileBorder(position, nextPosition, direction.x != 0, direction.y != 0))
|
||||
{
|
||||
// Debug.Log($"{gameObject} turned around");
|
||||
SetDirection(direction * -1);
|
||||
Debug.Log($"{gameObject} turned around to direction {GetDirection()}");
|
||||
turnAroundSoon = false;
|
||||
return GridMoverTools.PositionToGrid(nextPosition);
|
||||
}
|
||||
|
||||
if (kinematic)
|
||||
@@ -232,6 +233,12 @@ namespace Marro.PacManUdon
|
||||
// Debug.Log($"{gameObject} crossed tile center {gridPosition}, new target: {target}, new direction: {direction}");
|
||||
}
|
||||
|
||||
var distance = Vector2.Distance(position, nextPosition);
|
||||
if (distance > 0.5f)
|
||||
{
|
||||
Debug.LogError($"{gameObject} Just jumped by distance {distance}! position: {position}, nextPosition: {nextPosition}, direction: {direction}, offGrid: {offGrid}, ghostState: {ghostState}");
|
||||
}
|
||||
|
||||
return nextPosition;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace Marro.PacManUdon
|
||||
}
|
||||
|
||||
// Debug.Log($"{gameObject} GhostCaughtQueue with ghost {ghost}");
|
||||
networkManager.SendEventSoon(NetworkEventType.GhostUpdate);
|
||||
//networkManager.SendEventSoon(NetworkEventType.GhostUpdate);
|
||||
ghostScaredQueue.Add(ghost);
|
||||
GhostCaughtExecute(ghost);
|
||||
}
|
||||
@@ -576,6 +576,7 @@ namespace Marro.PacManUdon
|
||||
}
|
||||
ghostScaredQueue.Add(ghosts[ghostIndex]);
|
||||
}
|
||||
index += ghosts.Length;
|
||||
Debug.Log($"{gameObject} Read back a ghostScareQueue of length {ghostScaredQueue.Count}");
|
||||
|
||||
return true;
|
||||
|
||||
@@ -272,6 +272,7 @@ namespace Marro.PacManUdon
|
||||
{
|
||||
if (IsOwner)
|
||||
{
|
||||
ProcessEventsToSend(); // Prepare events from last cycle
|
||||
ProgressPingTime(); // See if we need to send a ping
|
||||
}
|
||||
else
|
||||
@@ -282,11 +283,6 @@ namespace Marro.PacManUdon
|
||||
|
||||
// Forwards simulated time at the FixedUpdate pace
|
||||
PerformFixedSyncedUpdate();
|
||||
|
||||
if (IsOwner)
|
||||
{
|
||||
ProcessEventsToSend();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateInternalTime()
|
||||
@@ -709,7 +705,7 @@ namespace Marro.PacManUdon
|
||||
Synced = true;
|
||||
}
|
||||
|
||||
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Processed incoming event! Total {index} bytes.");
|
||||
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Performed incoming eventof type {eventType}! Total {index} bytes.");
|
||||
|
||||
retriesWithoutSuccess = 0; // We had success!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user