Working on ghost issues
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user