Pellet collision

This commit is contained in:
2026-06-15 14:36:07 +02:00
parent 246718f1bd
commit c601dda10a
9 changed files with 318 additions and 229 deletions

View File

@@ -105,7 +105,7 @@ namespace Marro.PacManUdon
public void NewLevel()
{
SetSharedPelletCounterActive(false);
UpdateElroyLevel();
UpdateElroyLevel(pelletManager.PelletCount);
foreach (Ghost ghost in ghosts)
{
ghost.ResetHousePelletCounter();
@@ -404,11 +404,11 @@ namespace Marro.PacManUdon
}
}
public void PelletConsumed()
public void PelletConsumed(int pelletsRemainingCount)
{
pelletTimeout = 0;
UpdateElroyLevel();
UpdateElroyLevel(pelletsRemainingCount);
if (sharedPelletCounterActive)
{
@@ -452,14 +452,13 @@ namespace Marro.PacManUdon
}
}
void UpdateElroyLevel()
void UpdateElroyLevel(int pelletsRemainingCount)
{
// Debug.Log($"{gameObject} Updating Elroy Level with pelletsRemaining {pelletsRemaining} with elroy2PelletCount {elroy2PelletCount} and elroy1PelletCount {elroy1PelletCount}");
var oldElroyLevel = elroyLevel;
var pelletsRemaining = pelletManager.PelletCount - pelletManager.PelletCollectedCount;
if (pelletsRemaining < elroy2PelletCount) elroyLevel = 2;
else if (pelletsRemaining < elroy1PelletCount) elroyLevel = 1;
if (pelletsRemainingCount < elroy2PelletCount) elroyLevel = 2;
else if (pelletsRemainingCount < elroy1PelletCount) elroyLevel = 1;
else elroyLevel = 0;
if (elroyLevel != oldElroyLevel)