More cleanup
This commit is contained in:
@@ -227,16 +227,6 @@ namespace Marro.PacManUdon
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckCollisionInDirection(Transform transform, Vector2 position, Vector2 direction)
|
|
||||||
{
|
|
||||||
// Debug.Log("Collision check");
|
|
||||||
bool result = Physics.Linecast(transform.parent.TransformPoint(position), transform.parent.TransformPoint(position + direction.normalized), 1 << 22, QueryTriggerInteraction.Ignore);
|
|
||||||
// Debug.DrawLine(transform.parent.TransformPoint(position), transform.parent.TransformPoint(position + direction.normalized), Color.red, 1);
|
|
||||||
// Debug.Log($"{gameObject} Collision; Position {position} became {transform.parent.TransformPoint(position)}, direction {direction.normalized} became {transform.parent.TransformDirection(direction.normalized)}");
|
|
||||||
// Debug.Log("collision check for " + position + " in direction " + direction + " returned " + result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ namespace Marro.PacManUdon
|
|||||||
{
|
{
|
||||||
nextValidDirectionIndex += 1;
|
nextValidDirectionIndex += 1;
|
||||||
}
|
}
|
||||||
if (!CheckCollisionInDirection(transform, nextPosition, directionVectors[(int)predefinedPath[nextValidDirectionIndex]]))
|
if (!pelletManager.IsWallUpcoming(nextPosition, directionVectors[(int)predefinedPath[nextValidDirectionIndex]]))
|
||||||
{
|
{
|
||||||
// If we're at a Vector2.zero, we skip applying the direction and only increment.
|
// If we're at a Vector2.zero, we skip applying the direction and only increment.
|
||||||
if (nextValidDirectionIndex == predefinedPathIndex)
|
if (nextValidDirectionIndex == predefinedPathIndex)
|
||||||
|
|||||||
Reference in New Issue
Block a user