From 77ba7ec9c64b162915496474a2a4bdd35fe85302 Mon Sep 17 00:00:00 2001 From: Marro64 Date: Fri, 19 Jun 2026 12:53:58 +0200 Subject: [PATCH] Fixed ghost blink --- Assets/Scripts/Ghost.cs | 7 +------ Assets/Scripts/GhostManager.cs | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Assets/Scripts/Ghost.cs b/Assets/Scripts/Ghost.cs index 31c3501..81a7ba8 100644 --- a/Assets/Scripts/Ghost.cs +++ b/Assets/Scripts/Ghost.cs @@ -501,12 +501,7 @@ namespace Marro.PacManUdon { SetAnimatorGhostType((int)PacManGhostType.Special); } - else if (isScared) - { - - SetAnimatorGhostType((int)PacManGhostType.Scared); - } - else + else if (!isScared) { switch (ghostState) { diff --git a/Assets/Scripts/GhostManager.cs b/Assets/Scripts/GhostManager.cs index b1e2bac..caa7cbe 100644 --- a/Assets/Scripts/GhostManager.cs +++ b/Assets/Scripts/GhostManager.cs @@ -94,7 +94,7 @@ namespace Marro.PacManUdon SetSharedPelletCounterActive(true); } - foreach (Ghost ghost in ghosts) + foreach (var ghost in ghosts) { ghost.Reset(); } @@ -176,7 +176,7 @@ namespace Marro.PacManUdon for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++) { - Ghost ghost = ghosts[ghostIndex]; + var ghost = ghosts[ghostIndex]; if (ghost.GetGhostState() == PacManGhostState.Home) { ghost.Release(); @@ -277,7 +277,7 @@ namespace Marro.PacManUdon void SetGhostBlinkingState(bool white) { blinkCurrentlyWhite = white; - foreach (Ghost ghost in ghosts) + foreach (var ghost in ghosts) { ghost.SetWhite(white); } @@ -292,7 +292,7 @@ namespace Marro.PacManUdon powerPelletCountdown = powerPelletDuration; powerPelletMultiplier = 0; SetGhostBlinking(false); - foreach (Ghost ghost in ghosts) + foreach (var ghost in ghosts) { ghost.BecomeScared(); } @@ -310,7 +310,7 @@ namespace Marro.PacManUdon public void SetFrozen(bool frozen, bool ignoreIfCaught = false) { this.frozen = frozen; - foreach (Ghost ghost in ghosts) + foreach (var ghost in ghosts) { ghost.SetFrozen(frozen, ignoreIfCaught: ignoreIfCaught); } @@ -380,7 +380,7 @@ namespace Marro.PacManUdon void SetScattering(bool scattering, bool reverseDirection = true) { //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 { @@ -398,7 +398,7 @@ namespace Marro.PacManUdon { //Debug.Log($"{gameObject} SetSharedPelletCounterActive {active}"); sharedPelletCounterActive = active; - foreach (Ghost ghost in ghosts) + foreach (var ghost in ghosts) { ghost.SetHousePelletCounterActive(!active); } @@ -426,7 +426,7 @@ namespace Marro.PacManUdon //Debug.Log($"Incremented shared pellet counter to {sharedPelletCounter}"); for (int ghostIndex = 0; ghostIndex < sharedPelletCounterReleaseValues.Length; ghostIndex++) { - Ghost ghost = ghosts[ghostIndex]; + var ghost = ghosts[ghostIndex]; if (ghost.GetGhostState() == PacManGhostState.Home && sharedPelletCounter == sharedPelletCounterReleaseValues[ghostIndex]) { ghost.Release(); @@ -443,7 +443,7 @@ namespace Marro.PacManUdon { for (int ghostIndex = 0; ghostIndex < ghosts.Length; ghostIndex++) { - Ghost ghost = ghosts[ghostIndex]; + var ghost = ghosts[ghostIndex]; if (ghost.GetGhostState() == PacManGhostState.Home) { ghost.IncrementHousePelletCounter(); @@ -470,7 +470,7 @@ namespace Marro.PacManUdon public void SetActive(bool active) { gameObject.SetActive(active); - foreach (Ghost ghost in ghosts) + foreach (var ghost in ghosts) { ghost.SetActive(active); } @@ -479,7 +479,7 @@ namespace Marro.PacManUdon public void SetKinematic(bool kinematic) { this.kinematic = kinematic; - foreach (Ghost ghost in ghosts) + foreach (var ghost in ghosts) { ghost.SetKinematic(kinematic); }