Cleaning
This commit is contained in:
@@ -70,7 +70,6 @@ namespace Marro.PacManUdon
|
||||
private bool isScared;
|
||||
private bool scattering;
|
||||
private PacManGhostFrozenState frozenState;
|
||||
private Direction targetDirection;
|
||||
|
||||
// Home
|
||||
private bool offGrid;
|
||||
@@ -174,8 +173,7 @@ namespace Marro.PacManUdon
|
||||
&& CrossesTileCenter(position, nextPosition, direction))
|
||||
{
|
||||
var newDirection = GetInverseDirection(direction);
|
||||
SetDirection(newDirection);
|
||||
SetTargetDirection(newDirection);
|
||||
SetDirectionAndTargetDirection(newDirection);
|
||||
turnAroundSoon = false;
|
||||
return nextPosition;
|
||||
}
|
||||
@@ -249,8 +247,7 @@ namespace Marro.PacManUdon
|
||||
}
|
||||
if ((XAxisAlligned || YAxisAlligned) && offGrid)
|
||||
{
|
||||
SetDirection(GetOffGridDirectionToTarget(nextPosition, target, direction));
|
||||
SetTargetDirection(direction);
|
||||
SetDirectionAndTargetDirection(GetOffGridDirectionToTarget(nextPosition, target, direction));
|
||||
// Debug.Log($"{gameObject} Alligned X Axis: {XAxisAlligned}, Y Axis: {YAxisAlligned} with position: {position}, new nextPosition: {nextPosition}, new target: {target}, now moving in direction {direction}");
|
||||
// nextPosition = GridMover.GetNextPosition(position, direction, speed);
|
||||
}
|
||||
@@ -294,12 +291,6 @@ namespace Marro.PacManUdon
|
||||
SetDirection(targetDirection);
|
||||
}
|
||||
|
||||
protected void SetTargetDirection(Direction direction)
|
||||
{
|
||||
targetDirection = direction;
|
||||
UpdateAnimator();
|
||||
}
|
||||
|
||||
private void ProcessPredefinedPath(Vector2 position, ref Vector2 nextPosition)
|
||||
{
|
||||
if (CrossesTileCenter(position, nextPosition, direction))
|
||||
@@ -315,8 +306,7 @@ namespace Marro.PacManUdon
|
||||
// If we're at a Vector2.zero, we skip applying the direction and only increment.
|
||||
if (nextValidDirectionIndex == predefinedPathIndex)
|
||||
{
|
||||
SetDirection(predefinedPath[nextValidDirectionIndex]);
|
||||
SetTargetDirection(direction);
|
||||
SetDirectionAndTargetDirection(predefinedPath[nextValidDirectionIndex]);
|
||||
nextPosition = PositionToGrid(nextPosition) + GetVector(direction) * 0.01f;
|
||||
|
||||
// Check if we've reached the end of the path, which includes making sure the path doesn't end on Vector2.zero
|
||||
@@ -442,8 +432,7 @@ namespace Marro.PacManUdon
|
||||
case PacManGhostState.Exiting:
|
||||
offGrid = false;
|
||||
SetState(PacManGhostState.Normal);
|
||||
SetDirection(Direction.Left);
|
||||
SetTargetDirection(Direction.Left);
|
||||
SetDirectionAndTargetDirection(Direction.Left);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -452,13 +441,12 @@ namespace Marro.PacManUdon
|
||||
{
|
||||
if (startHorizontal)
|
||||
{
|
||||
SetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Right));
|
||||
SetDirectionAndTargetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Right));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Down));
|
||||
SetDirectionAndTargetDirection(GetOffGridDirectionToTarget(GetPosition(), newTarget, Direction.Down));
|
||||
}
|
||||
SetTargetDirection(direction);
|
||||
// Debug.Log($"{gameObject} SetOffGridTarget with position {GetPosition()}, newTarget {newTarget}, startHorizontal {startHorizontal} resulted in direction {direction}");
|
||||
target = newTarget;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user