Pacman syncs really well now

This commit is contained in:
2026-01-16 20:36:21 +01:00
parent c41491e55e
commit 154c642cce
15 changed files with 1099 additions and 593 deletions

View File

@@ -55,19 +55,20 @@ namespace Marro.PacManUdon
private bool kinematic;
// This should be called once when the game is initialized
public void Initialize(Transform[] ghostTargets, PacMan pacMan, GameManager gameController)
public void Initialize(Transform[] ghostStarts, Transform[] ghostTargets, PacMan pacMan, GameManager gameController)
{
this.gameController = gameController;
ghosts = transform.GetComponentsInChildren<Ghost>(true);
blinky = ghosts[0];
for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++)
{
Transform startTransform = ghostStarts[ghostIndex];
Vector2 homePosition = ghostTargets[0].localPosition;
Vector2 idlePosition1 = ghostTargets[1 + ghostIndex * 3].localPosition;
Vector2 idlePosition2 = ghostTargets[2 + ghostIndex * 3].localPosition;
Vector2 cornerPosition = ghostTargets[3 + ghostIndex * 3].localPosition;
ghosts[ghostIndex].Initialize(pacMan, blinky, homePosition, idlePosition1, idlePosition2, cornerPosition);
ghosts[ghostIndex].Initialize(pacMan, blinky, startTransform, homePosition, idlePosition1, idlePosition2, cornerPosition);
}
}