Fixed ghost blink

This commit is contained in:
2026-06-19 12:53:58 +02:00
parent 46e1207c37
commit 77ba7ec9c6
2 changed files with 12 additions and 17 deletions

View File

@@ -501,12 +501,7 @@ namespace Marro.PacManUdon
{ {
SetAnimatorGhostType((int)PacManGhostType.Special); SetAnimatorGhostType((int)PacManGhostType.Special);
} }
else if (isScared) else if (!isScared)
{
SetAnimatorGhostType((int)PacManGhostType.Scared);
}
else
{ {
switch (ghostState) switch (ghostState)
{ {

View File

@@ -94,7 +94,7 @@ namespace Marro.PacManUdon
SetSharedPelletCounterActive(true); SetSharedPelletCounterActive(true);
} }
foreach (Ghost ghost in ghosts) foreach (var ghost in ghosts)
{ {
ghost.Reset(); ghost.Reset();
} }
@@ -176,7 +176,7 @@ namespace Marro.PacManUdon
for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++) for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++)
{ {
Ghost ghost = ghosts[ghostIndex]; var ghost = ghosts[ghostIndex];
if (ghost.GetGhostState() == PacManGhostState.Home) if (ghost.GetGhostState() == PacManGhostState.Home)
{ {
ghost.Release(); ghost.Release();
@@ -277,7 +277,7 @@ namespace Marro.PacManUdon
void SetGhostBlinkingState(bool white) void SetGhostBlinkingState(bool white)
{ {
blinkCurrentlyWhite = white; blinkCurrentlyWhite = white;
foreach (Ghost ghost in ghosts) foreach (var ghost in ghosts)
{ {
ghost.SetWhite(white); ghost.SetWhite(white);
} }
@@ -292,7 +292,7 @@ namespace Marro.PacManUdon
powerPelletCountdown = powerPelletDuration; powerPelletCountdown = powerPelletDuration;
powerPelletMultiplier = 0; powerPelletMultiplier = 0;
SetGhostBlinking(false); SetGhostBlinking(false);
foreach (Ghost ghost in ghosts) foreach (var ghost in ghosts)
{ {
ghost.BecomeScared(); ghost.BecomeScared();
} }
@@ -310,7 +310,7 @@ namespace Marro.PacManUdon
public void SetFrozen(bool frozen, bool ignoreIfCaught = false) public void SetFrozen(bool frozen, bool ignoreIfCaught = false)
{ {
this.frozen = frozen; this.frozen = frozen;
foreach (Ghost ghost in ghosts) foreach (var ghost in ghosts)
{ {
ghost.SetFrozen(frozen, ignoreIfCaught: ignoreIfCaught); ghost.SetFrozen(frozen, ignoreIfCaught: ignoreIfCaught);
} }
@@ -380,7 +380,7 @@ namespace Marro.PacManUdon
void SetScattering(bool scattering, bool reverseDirection = true) void SetScattering(bool scattering, bool reverseDirection = true)
{ {
//Debug.Log($"{gameObject} SetScattering: {scattering}"); //Debug.Log($"{gameObject} SetScattering: {scattering}");
foreach (Ghost ghost in ghosts) foreach (var ghost in ghosts)
{ {
if (ghost == blinky && elroyLevel > 0) // Once blinky is elroy he no longer scatters if (ghost == blinky && elroyLevel > 0) // Once blinky is elroy he no longer scatters
{ {
@@ -398,7 +398,7 @@ namespace Marro.PacManUdon
{ {
//Debug.Log($"{gameObject} SetSharedPelletCounterActive {active}"); //Debug.Log($"{gameObject} SetSharedPelletCounterActive {active}");
sharedPelletCounterActive = active; sharedPelletCounterActive = active;
foreach (Ghost ghost in ghosts) foreach (var ghost in ghosts)
{ {
ghost.SetHousePelletCounterActive(!active); ghost.SetHousePelletCounterActive(!active);
} }
@@ -426,7 +426,7 @@ namespace Marro.PacManUdon
//Debug.Log($"Incremented shared pellet counter to {sharedPelletCounter}"); //Debug.Log($"Incremented shared pellet counter to {sharedPelletCounter}");
for (int ghostIndex = 0; ghostIndex < sharedPelletCounterReleaseValues.Length; ghostIndex++) for (int ghostIndex = 0; ghostIndex < sharedPelletCounterReleaseValues.Length; ghostIndex++)
{ {
Ghost ghost = ghosts[ghostIndex]; var ghost = ghosts[ghostIndex];
if (ghost.GetGhostState() == PacManGhostState.Home && sharedPelletCounter == sharedPelletCounterReleaseValues[ghostIndex]) if (ghost.GetGhostState() == PacManGhostState.Home && sharedPelletCounter == sharedPelletCounterReleaseValues[ghostIndex])
{ {
ghost.Release(); ghost.Release();
@@ -443,7 +443,7 @@ namespace Marro.PacManUdon
{ {
for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++) for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++)
{ {
Ghost ghost = ghosts[ghostIndex]; var ghost = ghosts[ghostIndex];
if (ghost.GetGhostState() == PacManGhostState.Home) if (ghost.GetGhostState() == PacManGhostState.Home)
{ {
ghost.IncrementHousePelletCounter(); ghost.IncrementHousePelletCounter();
@@ -470,7 +470,7 @@ namespace Marro.PacManUdon
public void SetActive(bool active) public void SetActive(bool active)
{ {
gameObject.SetActive(active); gameObject.SetActive(active);
foreach (Ghost ghost in ghosts) foreach (var ghost in ghosts)
{ {
ghost.SetActive(active); ghost.SetActive(active);
} }
@@ -479,7 +479,7 @@ namespace Marro.PacManUdon
public void SetKinematic(bool kinematic) public void SetKinematic(bool kinematic)
{ {
this.kinematic = kinematic; this.kinematic = kinematic;
foreach (Ghost ghost in ghosts) foreach (var ghost in ghosts)
{ {
ghost.SetKinematic(kinematic); ghost.SetKinematic(kinematic);
} }