Pellet collision
This commit is contained in:
@@ -61,7 +61,7 @@ namespace Marro.PacManUdon
|
||||
ghostManager.Initialize(maze.ghostStarts, maze.ghostTargets, pacMan, pelletManager, this);
|
||||
pacMan.Initialize(playerInput, maze.pacManStart, this, pelletManager);
|
||||
bonusFruit.Initialize();
|
||||
pelletManager.Initialize();
|
||||
pelletManager.Initialize(this);
|
||||
statusDisplay.Initialize();
|
||||
playerInput.Initialize(this);
|
||||
soundManager.Initialize();
|
||||
@@ -163,25 +163,35 @@ namespace Marro.PacManUdon
|
||||
SetFrozen(true);
|
||||
}
|
||||
|
||||
public void GotPellet(Pellet pellet, bool addScore = true)
|
||||
internal void GotPellet(Pellet pellet, PelletType pelletType, int pelletsCollectedCount, int pelletsRemainingCount)
|
||||
{
|
||||
var pelletCollectedCount = pelletManager.PelletCollected(pellet);
|
||||
AddScore(pelletType == PelletType.PowerPellet ? 50 : 10);
|
||||
|
||||
if (addScore) AddScore(10);
|
||||
|
||||
ghostManager.PelletConsumed();
|
||||
ghostManager.PelletConsumed(pelletsRemainingCount);
|
||||
|
||||
soundManager.PlayPelletSound();
|
||||
soundManager.UpdatePelletCount(pelletsRemainingCount);
|
||||
|
||||
var pelletCountRemaining = pelletManager.PelletCount - pelletCollectedCount;
|
||||
|
||||
soundManager.UpdatePelletCount(pelletCountRemaining);
|
||||
|
||||
if (pelletCountRemaining <= 0)
|
||||
if (pelletsRemainingCount <= 0)
|
||||
{
|
||||
StartTimeSequence(PacManTimeSequence.BoardClear);
|
||||
return;
|
||||
}
|
||||
else if (pelletCollectedCount == 70 || pelletCollectedCount == 170)
|
||||
|
||||
if (pelletType == PelletType.PowerPellet)
|
||||
{
|
||||
if (gameState == PacManGameState.AttractMode)
|
||||
{
|
||||
TimeSequenceSkipToNextStep();
|
||||
return;
|
||||
}
|
||||
|
||||
ghostManager.SetPowerPellet(true);
|
||||
pacMan.SetPowerPellet(true);
|
||||
soundManager.SetGhostBlue(true);
|
||||
}
|
||||
|
||||
if (pelletsCollectedCount == 70 || pelletsCollectedCount == 170)
|
||||
{
|
||||
bonusFruit.Spawn();
|
||||
}
|
||||
@@ -191,16 +201,7 @@ namespace Marro.PacManUdon
|
||||
{
|
||||
//Debug.Log($"{gameObject} GotPowerPellet");
|
||||
|
||||
if (gameState == PacManGameState.AttractMode)
|
||||
{
|
||||
TimeSequenceSkipToNextStep();
|
||||
return;
|
||||
}
|
||||
GotPellet(pellet, addScore: false);
|
||||
AddScore(50);
|
||||
ghostManager.SetPowerPellet(true);
|
||||
pacMan.SetPowerPellet(true);
|
||||
soundManager.SetGhostBlue(true);
|
||||
|
||||
}
|
||||
|
||||
public void EndPowerPellet()
|
||||
@@ -453,4 +454,4 @@ namespace Marro.PacManUdon
|
||||
|
||||
public int Level => level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user