Refactored starting new level

This commit is contained in:
2026-06-22 15:20:43 +02:00
parent 7f87a9779b
commit 4ba203b1de
8 changed files with 876 additions and 840 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -132,22 +132,14 @@ namespace Marro.PacManUdon
SetLevel(1);
}
private void InitializeLevel()
{
//Debug.Log($"{gameObject} New level started!");
ghostManager.NewLevel();
mazeSpriteAnimator.SetBool("Blinking", false);
}
private void RestartLevel(bool afterLifeLost = false)
{
//Debug.Log($"{gameObject} (Re)started level!");
// SetInGameComponentVisibility(true);
mazeSpriteAnimator.SetBool("Blinking", false);
ghostManager.RestartLevel(afterLifeLost);
ghostManager.NewLevel();
pacMan.Reset();
bonusFruit.Despawn();
soundManager.Reset();

View File

@@ -292,8 +292,9 @@ namespace Marro.PacManUdon
for (int i = 0; i < ghosts.Length; i++)
{
ghosts[i].SetHousePelletCounterLimit(privatePelletCounterReleaseValues[i]);
RestartLevel(); // Reset needed to properly apply level
}
RestartLevel(); // Reset needed to properly apply level
}
private void SetLevelConstants(int level)

View File

@@ -14,7 +14,6 @@ namespace Marro.PacManUdon
SetGameState(PacManGameState.AttractModeDemo);
break;
case 1:
InitializeLevel();
SetMazeVisible(true);
SetLevel(1);
break;

View File

@@ -42,7 +42,6 @@ namespace Marro.PacManUdon
SetFrozen(false);
soundManager.SuppressSound(false);
soundManager.StartGhostSound();
soundManager.UpdatePelletCount(collisionManager.PelletCount - collisionManager.PelletCollectedCount);
}
}
}

View File

@@ -11,7 +11,6 @@ namespace Marro.PacManUdon
gameState = PacManGameState.InGame;
InitializeNewGame();
InitializeLevel();
PrepareForCutscene();
soundManager.SuppressSound(false);

View File

@@ -10,7 +10,6 @@ namespace Marro.PacManUdon
PrepareForCutscene();
// Reset, show maze and score display
InitializeLevel();
SetMazeVisible(true);
statusDisplay.SetScoreDisplayVisible(true);
break;