diff --git a/Assets/Scripts/GameModeManager.cs b/Assets/Scripts/GameModeManager.cs index 269d228..f9935aa 100644 --- a/Assets/Scripts/GameModeManager.cs +++ b/Assets/Scripts/GameModeManager.cs @@ -326,12 +326,53 @@ public class GameModeManager : MonoBehaviour if (_paused) return; if (_modes.Count == 0) return; + // Match resolution (the end-of-match reveal window) is watch-only: painting is off. Force out of Paint + // mode and keep the switch key from re-entering it. Local + owner by construction - this manager drives + // only the local avatar's cycle; remotes have no modes. No restore needed: the match ends by despawning + // and respawning the avatar, which rebuilds the cycle at index 0. + bool suppressPaint = PaintSuppressed(); + if (suppressPaint && ActiveMode is PaintMode) + { + int fallback = FirstNonPaintFrom(0); + if (fallback >= 0) SwitchTo(fallback); + else if (painter) painter.PaintingEnabled = false; // degenerate paint-only set: at least stop painting + } + if (WasSwitchPressed()) - SwitchTo((_activeIndex + 1) % _modes.Count); + { + int next = (_activeIndex + 1) % _modes.Count; + if (suppressPaint && _modes[next] is PaintMode) + { + int skip = FirstNonPaintFrom(next); + if (skip >= 0) next = skip; + } + SwitchTo(next); + } ActiveMode?.Tick(); } + /// True while the local match is in its resolution (reveal) phase, during which painting is + /// disabled for the local player regardless of role. + private bool PaintSuppressed() + { + var match = MatchManager.Instance; + return match && match.MatchActive && + match.LocalSubPhase == MatchManager.MatchSubPhase.Resolution; + } + + /// First non-Paint mode index at or after (wrapping once through the + /// cycle); -1 if the set has no non-paint mode (a degenerate paint-only configuration). + private int FirstNonPaintFrom(int start) + { + for (int step = 0; step < _modes.Count; step++) + { + int i = (start + step) % _modes.Count; + if (!(_modes[i] is PaintMode)) return i; + } + return -1; + } + /// Activates the mode at (Exit old, Enter new). public void SwitchTo(int index) {