From 1b295027f2fc86162f96900825020e0e46305f74 Mon Sep 17 00:00:00 2001 From: Brollyy Date: Mon, 7 Sep 2026 00:11:39 +0200 Subject: [PATCH 1/3] Allow effects to follow changing minigame cameras --- .../Effects/CameraShake/CameraShakeEffect.cs | 24 +++++++++++++-- .../Effects/CameraTilt/CameraTiltEffect.cs | 24 +++++++++++++-- .../Effects/ColorTint/ColorTintEffect.cs | 28 +++++++++++++++-- BopVisualEffects/Effects/Fog/FogEffect.cs | 28 +++++++++++++++-- .../HorizontalFlip/HorizontalFlipEffect.cs | 27 ++++++++++++++--- BopVisualEffects/Effects/Hsl/HslEffect.cs | 30 ++++++++++++++++--- .../Effects/Letterbox/LetterboxEffect.cs | 28 +++++++++++++++-- .../Effects/PixelGrid/PixelGridEffect.cs | 27 +++++++++++++++-- .../Effects/Scanlines/ScanlinesEffect.cs | 28 +++++++++++++++-- .../Effects/ScreenNoise/ScreenNoiseEffect.cs | 28 +++++++++++++++-- BopVisualEffects/Effects/Sepia/SepiaEffect.cs | 28 ++++++++++++++--- .../VerticalFlip/VerticalFlipEffect.cs | 27 ++++++++++++++--- .../Effects/Vignette/VignetteEffect.cs | 28 +++++++++++++++-- .../Effects/ZoomIn/ZoomInEffect.cs | 25 ++++++++++++++-- .../Effects/ZoomOut/ZoomOutEffect.cs | 25 ++++++++++++++-- docs/effects/README.md | 15 ++++++++++ 16 files changed, 371 insertions(+), 49 deletions(-) diff --git a/BopVisualEffects/Effects/CameraShake/CameraShakeEffect.cs b/BopVisualEffects/Effects/CameraShake/CameraShakeEffect.cs index 55a33c2..3b4c688 100644 --- a/BopVisualEffects/Effects/CameraShake/CameraShakeEffect.cs +++ b/BopVisualEffects/Effects/CameraShake/CameraShakeEffect.cs @@ -32,7 +32,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["amplitude"] = 0.1f, - ["frequency"] = 18.0f + ["frequency"] = 18.0f, + ["persist_between_minigames"] = false } }; } @@ -44,6 +45,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var amplitude = entity.GetFloat("amplitude"); var frequency = entity.GetFloat("frequency"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -54,7 +56,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, amplitude, frequency)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, amplitude, frequency, persist)); } } @@ -69,11 +71,12 @@ private sealed class CameraShakeRunner : MonoBehaviour private JukeboxScript? _jukebox; private Transform? _targetTransform; private Vector3 _initialLocalPosition; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float amplitude, float frequency) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float amplitude, float frequency, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; @@ -81,6 +84,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _endBeat = endBeat; _amplitude = Mathf.Max(0f, amplitude); _frequency = Mathf.Max(0.1f, frequency); + _persistBetweenMinigames = persistBetweenMinigames; InitializeTargetCamera(); } @@ -108,6 +112,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindCameraIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -150,6 +157,17 @@ private void InitializeTargetCamera() _initialized = true; } + private void RebindCameraIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _targetTransform == camera.transform) + return; + + ResetCameraTransform(); + _targetTransform = camera.transform; + _initialLocalPosition = _targetTransform.localPosition; + } + private void ResetCameraTransform() { if (_targetTransform is null) diff --git a/BopVisualEffects/Effects/CameraTilt/CameraTiltEffect.cs b/BopVisualEffects/Effects/CameraTilt/CameraTiltEffect.cs index 05a48b9..fbcad42 100644 --- a/BopVisualEffects/Effects/CameraTilt/CameraTiltEffect.cs +++ b/BopVisualEffects/Effects/CameraTilt/CameraTiltEffect.cs @@ -31,7 +31,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) resizable = true, properties = new Dictionary { - ["angle"] = 5.0f + ["angle"] = 5.0f, + ["persist_between_minigames"] = false } }; } @@ -42,6 +43,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var angle = entity.GetFloat("angle"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -52,7 +54,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, angle)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, angle, persist)); } } @@ -66,17 +68,19 @@ private sealed class CameraTiltRunner : MonoBehaviour private JukeboxScript? _jukebox; private Transform? _targetTransform; private Quaternion _initialLocalRotation; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float angle) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float angle, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _angle = angle; + _persistBetweenMinigames = persistBetweenMinigames; InitializeTargetCamera(); } @@ -104,6 +108,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindCameraIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -134,6 +141,17 @@ private void InitializeTargetCamera() _initialized = true; } + private void RebindCameraIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _targetTransform == camera.transform) + return; + + ResetCameraTransform(); + _targetTransform = camera.transform; + _initialLocalRotation = _targetTransform.localRotation; + } + private void ResetCameraTransform() { if (_targetTransform is null) diff --git a/BopVisualEffects/Effects/ColorTint/ColorTintEffect.cs b/BopVisualEffects/Effects/ColorTint/ColorTintEffect.cs index 6e34e13..7c63f1d 100644 --- a/BopVisualEffects/Effects/ColorTint/ColorTintEffect.cs +++ b/BopVisualEffects/Effects/ColorTint/ColorTintEffect.cs @@ -32,7 +32,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) resizable = true, properties = new Dictionary { - ["color"] = new MixtapeEventTemplates.ColorField(new Color(1.0f, 0.0f, 0.0f, 0.25f)) + ["color"] = new MixtapeEventTemplates.ColorField(new Color(1.0f, 0.0f, 0.0f, 0.25f)), + ["persist_between_minigames"] = false } }; } @@ -43,6 +44,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var color = entity.GetColor("color"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -53,7 +55,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, color)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, color, persist)); } } @@ -66,17 +68,20 @@ private sealed class ColorTintRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private ColorTintOverlay? _overlay; + private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, Color color) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, Color color, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _color = new Color(Mathf.Clamp01(color.r), Mathf.Clamp01(color.g), Mathf.Clamp01(color.b), Mathf.Clamp01(color.a)); + _persistBetweenMinigames = persistBetweenMinigames; InitializeOverlay(); } @@ -104,6 +109,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindOverlayIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -137,6 +145,7 @@ private void InitializeOverlay() return; _overlay = camera.gameObject.AddComponent(); + _camera = camera; _overlay.SetColor(_color); _initialized = true; } @@ -149,6 +158,19 @@ private void RemoveOverlay() } _overlay = null; + _camera = null; + } + + private void RebindOverlayIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveOverlay(); + _overlay = camera.gameObject.AddComponent(); + _camera = camera; + _overlay.SetColor(_color); } } diff --git a/BopVisualEffects/Effects/Fog/FogEffect.cs b/BopVisualEffects/Effects/Fog/FogEffect.cs index 05ff27a..db03d66 100644 --- a/BopVisualEffects/Effects/Fog/FogEffect.cs +++ b/BopVisualEffects/Effects/Fog/FogEffect.cs @@ -33,7 +33,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["color"] = new MixtapeEventTemplates.ColorField(new Color(0.8f, 0.8f, 0.9f, 0.6f)), - ["height"] = 0.5f + ["height"] = 0.5f, + ["persist_between_minigames"] = false } }; } @@ -45,6 +46,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var color = entity.GetColor("color"); var height = entity.GetFloat("height"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -55,7 +57,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, color, height)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, color, height, persist)); } } @@ -69,11 +71,13 @@ private sealed class FogRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private FogOverlay? _overlay; + private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, Color color, float height) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, Color color, float height, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; @@ -81,6 +85,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _endBeat = endBeat; _color = new Color(Mathf.Clamp01(color.r), Mathf.Clamp01(color.g), Mathf.Clamp01(color.b), Mathf.Clamp01(color.a)); _height = Mathf.Clamp01(height); + _persistBetweenMinigames = persistBetweenMinigames; InitializeOverlay(); } @@ -108,6 +113,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindOverlayIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -141,6 +149,7 @@ private void InitializeOverlay() return; _overlay = camera.gameObject.AddComponent(); + _camera = camera; _overlay.SetParams(_color, _height); _initialized = true; } @@ -153,6 +162,19 @@ private void RemoveOverlay() } _overlay = null; + _camera = null; + } + + private void RebindOverlayIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveOverlay(); + _overlay = camera.gameObject.AddComponent(); + _camera = camera; + _overlay.SetParams(_color, _height); } } diff --git a/BopVisualEffects/Effects/HorizontalFlip/HorizontalFlipEffect.cs b/BopVisualEffects/Effects/HorizontalFlip/HorizontalFlipEffect.cs index 2afc4ed..6663031 100644 --- a/BopVisualEffects/Effects/HorizontalFlip/HorizontalFlipEffect.cs +++ b/BopVisualEffects/Effects/HorizontalFlip/HorizontalFlipEffect.cs @@ -30,7 +30,10 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) dataModel = $"{pluginGuid}/{Id}", length = 2.0f, resizable = true, - properties = new Dictionary() + properties = new Dictionary + { + ["persist_between_minigames"] = false + } }; } @@ -41,6 +44,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; + var persist = entity.GetBool("persist_between_minigames", false); loader.scheduler.Schedule(startBeat, (System.Action?)SpawnAction); log.Debug($"Scheduled '{DisplayName}' from beat {startBeat:0.###} to {endBeat:0.###}."); @@ -49,7 +53,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, endBeat)); + runner.Initialize(loader, loader.jukebox, endBeat, persist)); } } @@ -60,15 +64,17 @@ private sealed class HorizontalFlipRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float endBeat) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float endBeat, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; _endBeat = endBeat; + _persistBetweenMinigames = persistBetweenMinigames; InitializeFlip(); } @@ -96,6 +102,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindCameraIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -128,6 +137,16 @@ private void RemoveFlip() CameraFlipService.RemoveHorizontalFlip(_camera); _camera = null; } + + private void RebindCameraIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveFlip(); + _camera = camera; + CameraFlipService.AddHorizontalFlip(camera); + } } } - diff --git a/BopVisualEffects/Effects/Hsl/HslEffect.cs b/BopVisualEffects/Effects/Hsl/HslEffect.cs index d10126e..3a95c1b 100644 --- a/BopVisualEffects/Effects/Hsl/HslEffect.cs +++ b/BopVisualEffects/Effects/Hsl/HslEffect.cs @@ -37,7 +37,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) ["hue_shift"] = 0.0f, ["saturation"] = 1.0f, ["lightness"] = 0.0f, - ["intensity"] = 1.0f + ["intensity"] = 1.0f, + ["persist_between_minigames"] = false } }; } @@ -51,6 +52,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var saturation = entity.GetFloat("saturation"); var lightness = entity.GetFloat("lightness"); var intensity = entity.GetFloat("intensity"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -61,7 +63,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, hueShift, saturation, lightness, intensity)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, hueShift, saturation, lightness, intensity, persist)); } } @@ -78,12 +80,13 @@ private sealed class HslRunner : MonoBehaviour private JukeboxScript? _jukebox; private Camera? _camera; private HslRequest? _request; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, - float hueShift, float saturation, float lightness, float intensity) + float hueShift, float saturation, float lightness, float intensity, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; @@ -93,6 +96,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _saturation = Mathf.Max(0f, saturation); _lightness = Mathf.Clamp(lightness, -0.5f, 0.5f); _maxIntensity = Mathf.Clamp01(intensity); + _persistBetweenMinigames = persistBetweenMinigames; InitializeRequest(); } @@ -120,6 +124,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindRequestIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -166,6 +173,22 @@ private void InitializeRequest() _initialized = true; } + private void RebindRequestIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + if (_camera is not null && _request is not null) + HslService.RemoveRequest(_camera, _request); + + _camera = camera; + _request = HslService.AddRequest(camera); + _request.HueShift = _hueShift; + _request.Saturation = _saturation; + _request.Lightness = _lightness; + } + private void RemoveRequest() { if (_camera != null && _request != null) @@ -178,4 +201,3 @@ private void RemoveRequest() } } } - diff --git a/BopVisualEffects/Effects/Letterbox/LetterboxEffect.cs b/BopVisualEffects/Effects/Letterbox/LetterboxEffect.cs index 0cf0057..8e89c9f 100644 --- a/BopVisualEffects/Effects/Letterbox/LetterboxEffect.cs +++ b/BopVisualEffects/Effects/Letterbox/LetterboxEffect.cs @@ -32,7 +32,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) resizable = true, properties = new Dictionary { - ["size"] = 0.1f + ["size"] = 0.1f, + ["persist_between_minigames"] = false } }; } @@ -43,6 +44,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var size = entity.GetFloat("size"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -53,7 +55,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, size)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, size, persist)); } } @@ -66,17 +68,20 @@ private sealed class LetterboxRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private LetterboxOverlay? _overlay; + private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float size) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float size, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _size = Mathf.Clamp(size, 0f, 0.49f); + _persistBetweenMinigames = persistBetweenMinigames; InitializeOverlay(); } @@ -104,6 +109,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindOverlayIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -137,6 +145,7 @@ private void InitializeOverlay() return; _overlay = camera.gameObject.AddComponent(); + _camera = camera; _overlay.SetParams(_size); _initialized = true; } @@ -149,6 +158,19 @@ private void RemoveOverlay() } _overlay = null; + _camera = null; + } + + private void RebindOverlayIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveOverlay(); + _overlay = camera.gameObject.AddComponent(); + _camera = camera; + _overlay.SetParams(_size); } } diff --git a/BopVisualEffects/Effects/PixelGrid/PixelGridEffect.cs b/BopVisualEffects/Effects/PixelGrid/PixelGridEffect.cs index d1e5f08..89ea7a8 100644 --- a/BopVisualEffects/Effects/PixelGrid/PixelGridEffect.cs +++ b/BopVisualEffects/Effects/PixelGrid/PixelGridEffect.cs @@ -33,7 +33,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) resizable = true, properties = new Dictionary { - ["pixel_size"] = 4.0f + ["pixel_size"] = 4.0f, + ["persist_between_minigames"] = false } }; } @@ -44,6 +45,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var pixelSize = entity.GetFloat("pixel_size"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -54,7 +56,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, pixelSize)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, pixelSize, persist)); } } @@ -67,17 +69,20 @@ private sealed class PixelGridRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private PixelGridOverlay? _overlay; + private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float pixelSize) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float pixelSize, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _pixelSize = Mathf.Clamp(Mathf.RoundToInt(pixelSize), 2, 64); + _persistBetweenMinigames = persistBetweenMinigames; InitializeOverlay(); } @@ -105,6 +110,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindOverlayIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -140,6 +148,7 @@ private void InitializeOverlay() return; _overlay = camera.gameObject.AddComponent(); + _camera = camera; _overlay.SetBlockSize(_pixelSize); _initialized = true; } @@ -152,6 +161,18 @@ private void RemoveOverlay() } _overlay = null; + _camera = null; + } + + private void RebindOverlayIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveOverlay(); + _overlay = camera.gameObject.AddComponent(); + _camera = camera; } } diff --git a/BopVisualEffects/Effects/Scanlines/ScanlinesEffect.cs b/BopVisualEffects/Effects/Scanlines/ScanlinesEffect.cs index af16a71..5ab351f 100644 --- a/BopVisualEffects/Effects/Scanlines/ScanlinesEffect.cs +++ b/BopVisualEffects/Effects/Scanlines/ScanlinesEffect.cs @@ -34,7 +34,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) { ["alpha"] = 0.35f, ["count"] = 60.0f, - ["scroll_speed"] = 0.0f + ["scroll_speed"] = 0.0f, + ["persist_between_minigames"] = false } }; } @@ -47,6 +48,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var alpha = entity.GetFloat("alpha"); var count = entity.GetFloat("count"); var scrollSpeed = entity.GetFloat("scroll_speed"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -57,7 +59,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, count, scrollSpeed)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, count, scrollSpeed, persist)); } } @@ -72,11 +74,13 @@ private sealed class ScanlinesRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private ScanlinesOverlay? _overlay; + private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float scrollSpeed) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float scrollSpeed, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; @@ -85,6 +89,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _alpha = Mathf.Clamp01(alpha); _count = Mathf.Clamp(Mathf.RoundToInt(count), 4, 2000); _scrollSpeed = scrollSpeed; + _persistBetweenMinigames = persistBetweenMinigames; InitializeOverlay(); } @@ -112,6 +117,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindOverlayIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -145,6 +153,7 @@ private void InitializeOverlay() return; _overlay = camera.gameObject.AddComponent(); + _camera = camera; _overlay.SetParams(_alpha, _count, _scrollSpeed); _initialized = true; } @@ -157,6 +166,19 @@ private void RemoveOverlay() } _overlay = null; + _camera = null; + } + + private void RebindOverlayIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveOverlay(); + _overlay = camera.gameObject.AddComponent(); + _camera = camera; + _overlay.SetParams(_alpha, _count, _scrollSpeed); } } diff --git a/BopVisualEffects/Effects/ScreenNoise/ScreenNoiseEffect.cs b/BopVisualEffects/Effects/ScreenNoise/ScreenNoiseEffect.cs index 4b0c240..02ea7ac 100644 --- a/BopVisualEffects/Effects/ScreenNoise/ScreenNoiseEffect.cs +++ b/BopVisualEffects/Effects/ScreenNoise/ScreenNoiseEffect.cs @@ -34,7 +34,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) { ["alpha"] = 0.5f, ["count"] = 400.0f, - ["size"] = 0.01f + ["size"] = 0.01f, + ["persist_between_minigames"] = false } }; } @@ -47,6 +48,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var alpha = entity.GetFloat("alpha"); var count = entity.GetFloat("count"); var size = entity.GetFloat("size"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -57,7 +59,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, count, size)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, count, size, persist)); } } @@ -72,11 +74,13 @@ private sealed class ScreenNoiseRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private ScreenNoiseOverlay? _overlay; + private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float size) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float size, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; @@ -85,6 +89,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _alpha = Mathf.Clamp01(alpha); _count = Mathf.Clamp(Mathf.RoundToInt(count), 10, 2000); _size = Mathf.Clamp(size, 0.005f, 0.1f); + _persistBetweenMinigames = persistBetweenMinigames; InitializeOverlay(); } @@ -112,6 +117,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindOverlayIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -145,6 +153,7 @@ private void InitializeOverlay() return; _overlay = camera.gameObject.AddComponent(); + _camera = camera; _overlay.SetParams(_alpha, _count, _size); _initialized = true; } @@ -157,6 +166,19 @@ private void RemoveOverlay() } _overlay = null; + _camera = null; + } + + private void RebindOverlayIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveOverlay(); + _overlay = camera.gameObject.AddComponent(); + _camera = camera; + _overlay.SetParams(_alpha, _count, _size); } } diff --git a/BopVisualEffects/Effects/Sepia/SepiaEffect.cs b/BopVisualEffects/Effects/Sepia/SepiaEffect.cs index f2a8592..4242fa0 100644 --- a/BopVisualEffects/Effects/Sepia/SepiaEffect.cs +++ b/BopVisualEffects/Effects/Sepia/SepiaEffect.cs @@ -34,7 +34,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) resizable = true, properties = new Dictionary { - ["intensity"] = 0.8f + ["intensity"] = 0.8f, + ["persist_between_minigames"] = false } }; } @@ -45,6 +46,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var intensity = entity.GetFloat("intensity"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -55,7 +57,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, intensity)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, intensity, persist)); } } @@ -69,17 +71,19 @@ private sealed class SepiaRunner : MonoBehaviour private JukeboxScript? _jukebox; private Camera? _camera; private SepiaRequest? _request; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _maxIntensity = Mathf.Clamp01(intensity); + _persistBetweenMinigames = persistBetweenMinigames; InitializeRequest(); } @@ -107,6 +111,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindRequestIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -145,6 +152,20 @@ private void InitializeRequest() _initialized = true; } + private void RebindRequestIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + if (_camera is not null && _request is not null) + SepiaService.RemoveRequest(_camera, _request); + + _camera = camera; + _request = SepiaService.AddRequest(camera); + _request.Intensity = _maxIntensity; + } + private void RemoveRequest() { if (_camera != null && _request != null) @@ -155,4 +176,3 @@ private void RemoveRequest() } } } - diff --git a/BopVisualEffects/Effects/VerticalFlip/VerticalFlipEffect.cs b/BopVisualEffects/Effects/VerticalFlip/VerticalFlipEffect.cs index a5e0e4e..10408b0 100644 --- a/BopVisualEffects/Effects/VerticalFlip/VerticalFlipEffect.cs +++ b/BopVisualEffects/Effects/VerticalFlip/VerticalFlipEffect.cs @@ -30,7 +30,10 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) dataModel = $"{pluginGuid}/{Id}", length = 2.0f, resizable = true, - properties = new Dictionary() + properties = new Dictionary + { + ["persist_between_minigames"] = false + } }; } @@ -41,6 +44,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; + var persist = entity.GetBool("persist_between_minigames", false); loader.scheduler.Schedule(startBeat, (System.Action?)SpawnAction); log.Debug($"Scheduled '{DisplayName}' from beat {startBeat:0.###} to {endBeat:0.###}."); @@ -49,7 +53,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, endBeat)); + runner.Initialize(loader, loader.jukebox, endBeat, persist)); } } @@ -60,15 +64,17 @@ private sealed class VerticalFlipRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float endBeat) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float endBeat, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; _endBeat = endBeat; + _persistBetweenMinigames = persistBetweenMinigames; InitializeFlip(); } @@ -96,6 +102,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindCameraIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -128,6 +137,16 @@ private void RemoveFlip() CameraFlipService.RemoveVerticalFlip(_camera); _camera = null; } + + private void RebindCameraIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveFlip(); + _camera = camera; + CameraFlipService.AddVerticalFlip(camera); + } } } - diff --git a/BopVisualEffects/Effects/Vignette/VignetteEffect.cs b/BopVisualEffects/Effects/Vignette/VignetteEffect.cs index d872743..2557907 100644 --- a/BopVisualEffects/Effects/Vignette/VignetteEffect.cs +++ b/BopVisualEffects/Effects/Vignette/VignetteEffect.cs @@ -33,7 +33,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["alpha"] = 0.7f, - ["size"] = 0.1f + ["size"] = 0.1f, + ["persist_between_minigames"] = false } }; } @@ -45,6 +46,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var alpha = entity.GetFloat("alpha"); var size = entity.GetFloat("size"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -55,7 +57,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, size)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, size, persist)); } } @@ -69,11 +71,13 @@ private sealed class VignetteRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private VignetteOverlay? _overlay; + private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float size) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float size, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; @@ -81,6 +85,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _endBeat = endBeat; _alpha = Mathf.Clamp01(alpha); _size = Mathf.Clamp(size, 0f, 0.5f); + _persistBetweenMinigames = persistBetweenMinigames; InitializeOverlay(); } @@ -108,6 +113,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindOverlayIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -141,6 +149,7 @@ private void InitializeOverlay() return; _overlay = camera.gameObject.AddComponent(); + _camera = camera; _overlay.SetParams(_alpha, _size); _initialized = true; } @@ -153,6 +162,19 @@ private void RemoveOverlay() } _overlay = null; + _camera = null; + } + + private void RebindOverlayIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveOverlay(); + _overlay = camera.gameObject.AddComponent(); + _camera = camera; + _overlay.SetParams(_alpha, _size); } } diff --git a/BopVisualEffects/Effects/ZoomIn/ZoomInEffect.cs b/BopVisualEffects/Effects/ZoomIn/ZoomInEffect.cs index 403b489..435f155 100644 --- a/BopVisualEffects/Effects/ZoomIn/ZoomInEffect.cs +++ b/BopVisualEffects/Effects/ZoomIn/ZoomInEffect.cs @@ -32,7 +32,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) resizable = true, properties = new Dictionary { - ["intensity"] = 0.2f + ["intensity"] = 0.2f, + ["persist_between_minigames"] = false } }; } @@ -43,6 +44,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var intensity = entity.GetFloat("intensity"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -53,7 +55,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, intensity)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, intensity, persist)); } } @@ -66,17 +68,19 @@ private sealed class ZoomInRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _intensity = Mathf.Clamp(intensity, 0f, 0.99f); + _persistBetweenMinigames = persistBetweenMinigames; InitializeTargetCamera(); } @@ -105,6 +109,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindCameraIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -142,5 +149,17 @@ private void InitializeTargetCamera() _camera = camera; _initialized = true; } + + private void RebindCameraIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + if (_camera is not null) + CameraZoomService.RemoveFactor(_camera, this); + + _camera = camera; + } } } diff --git a/BopVisualEffects/Effects/ZoomOut/ZoomOutEffect.cs b/BopVisualEffects/Effects/ZoomOut/ZoomOutEffect.cs index ff25b25..5d9b492 100644 --- a/BopVisualEffects/Effects/ZoomOut/ZoomOutEffect.cs +++ b/BopVisualEffects/Effects/ZoomOut/ZoomOutEffect.cs @@ -32,7 +32,8 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) resizable = true, properties = new Dictionary { - ["intensity"] = 0.2f + ["intensity"] = 0.2f, + ["persist_between_minigames"] = false } }; } @@ -43,6 +44,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var intensity = entity.GetFloat("intensity"); + var persist = entity.GetBool("persist_between_minigames", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -53,7 +55,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, intensity)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, intensity, persist)); } } @@ -66,17 +68,19 @@ private sealed class ZoomOutRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private Camera? _camera; + private bool _persistBetweenMinigames; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity, bool persistBetweenMinigames) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _intensity = Mathf.Max(0f, intensity); + _persistBetweenMinigames = persistBetweenMinigames; InitializeTargetCamera(); } @@ -105,6 +109,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindCameraIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -142,5 +149,17 @@ private void InitializeTargetCamera() _camera = camera; _initialized = true; } + + private void RebindCameraIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + if (_camera is not null) + CameraZoomService.RemoveFactor(_camera, this); + + _camera = camera; + } } } diff --git a/docs/effects/README.md b/docs/effects/README.md index f9cb92a..f7a2ebe 100644 --- a/docs/effects/README.md +++ b/docs/effects/README.md @@ -13,6 +13,7 @@ Adds a temporary camera shake effect for impact, hits, drops, or strong rhythm a **Properties** - `amplitude`: Strength of the shake. - `frequency`: Speed of the shake movement. +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -29,6 +30,7 @@ Briefly tilts the camera on its Z-axis with a smooth swing arc. **Properties** - `angle`: Maximum tilt angle in degrees (positive = counter-clockwise). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the tilt lasts, in beats. This event is resizable in the timeline. **Preview** @@ -45,6 +47,7 @@ Applies a sustained full-screen color tint that fades in, holds, then fades out. **Properties** - `color`: Tint color (default `#ff000040` — red with slight opacity). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -62,6 +65,7 @@ Draws a ground fog gradient overlay - opaque at the bottom of the screen, fading **Properties** - `color`: Fog color (default `#CCCCE599` - pale blue-gray). - `height`: Normalized screen height at which the fog fully fades to transparent (0–1; default `0.5`). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the fog lasts, in beats. This event is resizable in the timeline. **Preview** @@ -77,6 +81,7 @@ https://github.com/user-attachments/assets/d6c128bb-7b45-4654-9265-a0499195218a Mirrors the screen left-to-right for the duration of the event. Composes with Vertical Flip and zoom effects. **Properties** +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the flip lasts, in beats. This event is resizable in the timeline. **Preview** @@ -96,6 +101,7 @@ Adjusts hue, saturation and lightness of the whole screen for colour grading usi - `saturation`: Saturation multiplier (0 = fully greyscale, 1 = unchanged, >1 = boosted; default `1.0`). Boost above 1 requires shader bundle. - `lightness`: Additive lightness offset (-0.5–0.5; default `0`). Positive values brighten, negative values darken. - `intensity`: Overall blend strength (0–1; default `1.0`). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -112,6 +118,7 @@ Adds cinematic black bars at the top and bottom of the screen for a dramatic wid **Properties** - `size`: Height of each bar as a normalized screen fraction (0–0.49; default `0.1`). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -128,6 +135,7 @@ Pixelates the screen by downsampling the camera's rendered output to a low-resol **Properties** - `pixel_size`: Size of each pixel block in screen pixels (2–64; default `4`). Larger values produce a more pronounced 8-bit look. +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -146,6 +154,7 @@ Draws horizontal CRT-style scan lines over the screen for a retro aesthetic. Can - `alpha`: Darkness of each scan line (0–1; default `0.35`). - `count`: Number of scan lines (default `60`, clamped 4–2000). - `scroll_speed`: Speed at which lines scroll upward, in cells per second (default `0` = static; negative = scroll downward). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -164,6 +173,7 @@ Draws animated TV static noise specks over the screen for a glitchy atmosphere. - `alpha`: Maximum opacity of the noise specks (0–1; default `0.5`). - `count`: Number of noise specks drawn per frame (10–2000; default `400`). - `size`: Physical size of each speck in normalized screen coordinates (0.005–0.1; default `0.01`). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -180,6 +190,7 @@ Applies a warm vintage sepia-tone filter using a per-pixel shader (standard Adob **Properties** - `intensity`: Strength of the sepia toning (0–1; default `0.8`). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -195,6 +206,7 @@ https://github.com/user-attachments/assets/ff1025b3-1f4b-44c8-982f-6691fe861277 Mirrors the screen top-to-bottom for the duration of the event. Composes with Horizontal Flip and zoom effects. **Properties** +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the flip lasts, in beats. This event is resizable in the timeline. **Preview** @@ -212,6 +224,7 @@ Darkens the screen edges with a smooth radial/elliptical gradient using a 32-seg **Properties** - `alpha`: Darkness of the edge (0–1; default `0.7`). - `size`: How far the darkening extends inward as a fraction of screen half-height (0–0.5; default `0.1`). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -228,6 +241,7 @@ Eases the camera smoothly into a zoomed-in view, holds at the target level, then **Properties** - `intensity`: How far to zoom in, as a fraction of the camera's base size (e.g. `0.2` = 20% closer). Clamped to `[0, 0.99]`. +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** @@ -244,6 +258,7 @@ Eases the camera smoothly out to a wider view, holds, then eases back in. Compos **Properties** - `intensity`: How far to zoom out, as a fraction of the camera's base size (e.g. `0.2` = 20% further out). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. **Preview** From 3ce1787c2d654af25bd0a431a04194595b50e6f6 Mon Sep 17 00:00:00 2001 From: Brollyy Date: Tue, 8 Sep 2026 00:34:58 +0200 Subject: [PATCH 2/3] feat: persist speed lines across minigames --- .../Effects/SpeedLines/SpeedLinesEffect.cs | 35 +++++++++++++++++-- docs/effects/README.md | 1 + 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/BopVisualEffects/Effects/SpeedLines/SpeedLinesEffect.cs b/BopVisualEffects/Effects/SpeedLines/SpeedLinesEffect.cs index 573a56a..ce0b3a9 100644 --- a/BopVisualEffects/Effects/SpeedLines/SpeedLinesEffect.cs +++ b/BopVisualEffects/Effects/SpeedLines/SpeedLinesEffect.cs @@ -39,6 +39,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) ["speed"] = 3.5f, ["reach"] = DefaultReach, ["color"] = new MixtapeEventTemplates.ColorField(Color.white), + ["persist_between_minigames"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -55,6 +56,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var speed = entity.GetFloat("speed"); var reach = entity.GetFloat("reach"); var color = entity.GetColor("color"); + var persist = entity.GetBool("persist_between_minigames", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -66,7 +68,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, count, speed, reach, color, easeIn, easeOut)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, count, speed, reach, color, persist, easeIn, easeOut)); } } @@ -84,13 +86,14 @@ private sealed class SpeedLinesRunner : MonoBehaviour private JukeboxScript? _jukebox; private Camera? _camera; private SpeedLinesRequest? _request; + private bool _persistBetweenMinigames; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float speed, float reach, Color color, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float speed, float reach, Color color, bool persistBetweenMinigames, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; @@ -101,6 +104,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _speed = Mathf.Max(0.1f, speed); _reach = Mathf.Clamp01(reach); _color = new Color(Mathf.Clamp01(color.r), Mathf.Clamp01(color.g), Mathf.Clamp01(color.b), Mathf.Clamp01(color.a)); + _persistBetweenMinigames = persistBetweenMinigames; _easeIn = easeIn; _easeOut = easeOut; InitializeOverlay(); @@ -130,6 +134,9 @@ private void LateUpdate() return; } + if (_persistBetweenMinigames) + RebindOverlayIfNeeded(); + var currentBeat = _jukebox.CurrentBeat; if (currentBeat >= _endBeat) { @@ -172,6 +179,30 @@ private void RemoveOverlay() _camera = null; _request = null; } + + private void RebindOverlayIfNeeded() + { + Camera? camera = EffectRuntimeController.ResolveEffectCamera(_loader); + if (camera is null || _camera == camera) + return; + + RemoveOverlay(); + _camera = camera; + _request = SpeedLinesService.AddRequest(camera); + ApplyRequestParameters(); + } + + private void ApplyRequestParameters() + { + if (_request is null) + return; + + _request.Alpha = _alpha; + _request.Count = _count; + _request.Speed = _speed; + _request.Reach = _reach; + _request.Color = _color; + } } /// diff --git a/docs/effects/README.md b/docs/effects/README.md index 316e3f8..d4882b2 100644 --- a/docs/effects/README.md +++ b/docs/effects/README.md @@ -224,6 +224,7 @@ Draws an animated, noise-driven radial speed-line vignette. Thin colored streak - `speed`: Animation rate of the procedural noise in cycles per second (default `3.5`). Higher values produce faster-moving streaks. - `reach`: How far each speed line reaches toward the screen center as a normalized edge-to-center fraction (0–1; default `0.25`). `0` keeps the effect at the screen edge; `1` reaches the center. The calculation accounts for the screen aspect ratio. - `color`: Color and base opacity of the speed lines (default white). +- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade speed lines in over the first 15% of the event (default `true`). - `ease_out`: Fade speed lines out over the last 15% of the event (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. From ede12f254ec6c6a6559f2c5710a4a49f03896a3f Mon Sep 17 00:00:00 2001 From: Brollyy Date: Tue, 8 Sep 2026 23:43:42 +0200 Subject: [PATCH 3/3] refactor: shorten camera persistence parameter --- .../Effects/CameraShake/CameraShakeEffect.cs | 12 +++++----- .../Effects/CameraTilt/CameraTiltEffect.cs | 12 +++++----- .../Effects/ColorTint/ColorTintEffect.cs | 12 +++++----- BopVisualEffects/Effects/Fog/FogEffect.cs | 12 +++++----- .../HorizontalFlip/HorizontalFlipEffect.cs | 12 +++++----- BopVisualEffects/Effects/Hsl/HslEffect.cs | 12 +++++----- .../Effects/Letterbox/LetterboxEffect.cs | 12 +++++----- .../Effects/PixelGrid/PixelGridEffect.cs | 12 +++++----- .../Effects/Scanlines/ScanlinesEffect.cs | 12 +++++----- .../Effects/ScreenNoise/ScreenNoiseEffect.cs | 12 +++++----- BopVisualEffects/Effects/Sepia/SepiaEffect.cs | 12 +++++----- .../Effects/SpeedLines/SpeedLinesEffect.cs | 15 ++++++------ .../VerticalFlip/VerticalFlipEffect.cs | 12 +++++----- .../Effects/Vignette/VignetteEffect.cs | 12 +++++----- .../Effects/ZoomIn/ZoomInEffect.cs | 12 +++++----- .../Effects/ZoomOut/ZoomOutEffect.cs | 12 +++++----- docs/effects/README.md | 24 +++++++++---------- 17 files changed, 110 insertions(+), 109 deletions(-) diff --git a/BopVisualEffects/Effects/CameraShake/CameraShakeEffect.cs b/BopVisualEffects/Effects/CameraShake/CameraShakeEffect.cs index 3b4c688..2b17c4c 100644 --- a/BopVisualEffects/Effects/CameraShake/CameraShakeEffect.cs +++ b/BopVisualEffects/Effects/CameraShake/CameraShakeEffect.cs @@ -33,7 +33,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) { ["amplitude"] = 0.1f, ["frequency"] = 18.0f, - ["persist_between_minigames"] = false + ["persist_camera"] = false } }; } @@ -45,7 +45,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var amplitude = entity.GetFloat("amplitude"); var frequency = entity.GetFloat("frequency"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -71,12 +71,12 @@ private sealed class CameraShakeRunner : MonoBehaviour private JukeboxScript? _jukebox; private Transform? _targetTransform; private Vector3 _initialLocalPosition; - private bool _persistBetweenMinigames; + private bool _persistCamera; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float amplitude, float frequency, bool persistBetweenMinigames) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float amplitude, float frequency, bool persistCamera) { _loader = loader; _jukebox = jukebox; @@ -84,7 +84,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _endBeat = endBeat; _amplitude = Mathf.Max(0f, amplitude); _frequency = Mathf.Max(0.1f, frequency); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; InitializeTargetCamera(); } @@ -112,7 +112,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindCameraIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/CameraTilt/CameraTiltEffect.cs b/BopVisualEffects/Effects/CameraTilt/CameraTiltEffect.cs index fbcad42..3fbb694 100644 --- a/BopVisualEffects/Effects/CameraTilt/CameraTiltEffect.cs +++ b/BopVisualEffects/Effects/CameraTilt/CameraTiltEffect.cs @@ -32,7 +32,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["angle"] = 5.0f, - ["persist_between_minigames"] = false + ["persist_camera"] = false } }; } @@ -43,7 +43,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var angle = entity.GetFloat("angle"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; @@ -68,19 +68,19 @@ private sealed class CameraTiltRunner : MonoBehaviour private JukeboxScript? _jukebox; private Transform? _targetTransform; private Quaternion _initialLocalRotation; - private bool _persistBetweenMinigames; + private bool _persistCamera; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float angle, bool persistBetweenMinigames) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float angle, bool persistCamera) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _angle = angle; - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; InitializeTargetCamera(); } @@ -108,7 +108,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindCameraIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/ColorTint/ColorTintEffect.cs b/BopVisualEffects/Effects/ColorTint/ColorTintEffect.cs index 2919b33..b81e537 100644 --- a/BopVisualEffects/Effects/ColorTint/ColorTintEffect.cs +++ b/BopVisualEffects/Effects/ColorTint/ColorTintEffect.cs @@ -33,7 +33,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["color"] = new MixtapeEventTemplates.ColorField(new Color(1.0f, 0.0f, 0.0f, 0.25f)), - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -46,7 +46,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var color = entity.GetColor("color"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -73,21 +73,21 @@ private sealed class ColorTintRunner : MonoBehaviour private JukeboxScript? _jukebox; private ColorTintOverlay? _overlay; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, Color color, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, Color color, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _color = new Color(Mathf.Clamp01(color.r), Mathf.Clamp01(color.g), Mathf.Clamp01(color.b), Mathf.Clamp01(color.a)); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeOverlay(); @@ -117,7 +117,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindOverlayIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/Fog/FogEffect.cs b/BopVisualEffects/Effects/Fog/FogEffect.cs index 06281da..d221fbd 100644 --- a/BopVisualEffects/Effects/Fog/FogEffect.cs +++ b/BopVisualEffects/Effects/Fog/FogEffect.cs @@ -34,7 +34,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) { ["color"] = new MixtapeEventTemplates.ColorField(new Color(0.8f, 0.8f, 0.9f, 0.6f)), ["height"] = 0.5f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -48,7 +48,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var color = entity.GetColor("color"); var height = entity.GetFloat("height"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -76,14 +76,14 @@ private sealed class FogRunner : MonoBehaviour private JukeboxScript? _jukebox; private FogOverlay? _overlay; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, Color color, float height, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, Color color, float height, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; @@ -91,7 +91,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _endBeat = endBeat; _color = new Color(Mathf.Clamp01(color.r), Mathf.Clamp01(color.g), Mathf.Clamp01(color.b), Mathf.Clamp01(color.a)); _height = Mathf.Clamp01(height); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeOverlay(); @@ -121,7 +121,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindOverlayIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/HorizontalFlip/HorizontalFlipEffect.cs b/BopVisualEffects/Effects/HorizontalFlip/HorizontalFlipEffect.cs index 6663031..5d67799 100644 --- a/BopVisualEffects/Effects/HorizontalFlip/HorizontalFlipEffect.cs +++ b/BopVisualEffects/Effects/HorizontalFlip/HorizontalFlipEffect.cs @@ -32,7 +32,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) resizable = true, properties = new Dictionary { - ["persist_between_minigames"] = false + ["persist_camera"] = false } }; } @@ -44,7 +44,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); loader.scheduler.Schedule(startBeat, (System.Action?)SpawnAction); log.Debug($"Scheduled '{DisplayName}' from beat {startBeat:0.###} to {endBeat:0.###}."); @@ -64,17 +64,17 @@ private sealed class HorizontalFlipRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float endBeat, bool persistBetweenMinigames) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float endBeat, bool persistCamera) { _loader = loader; _jukebox = jukebox; _endBeat = endBeat; - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; InitializeFlip(); } @@ -102,7 +102,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindCameraIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/Hsl/HslEffect.cs b/BopVisualEffects/Effects/Hsl/HslEffect.cs index da759df..1a1d2fa 100644 --- a/BopVisualEffects/Effects/Hsl/HslEffect.cs +++ b/BopVisualEffects/Effects/Hsl/HslEffect.cs @@ -38,7 +38,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) ["saturation"] = 1.0f, ["lightness"] = 0.0f, ["intensity"] = 1.0f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -54,7 +54,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var saturation = entity.GetFloat("saturation"); var lightness = entity.GetFloat("lightness"); var intensity = entity.GetFloat("intensity"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -84,7 +84,7 @@ private sealed class HslRunner : MonoBehaviour private JukeboxScript? _jukebox; private Camera? _camera; private HslRequest? _request; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; @@ -92,7 +92,7 @@ private sealed class HslRunner : MonoBehaviour /// Initializes this runner with effect parameters. /// public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, - float hueShift, float saturation, float lightness, float intensity, bool persistBetweenMinigames, bool easeIn, bool easeOut) + float hueShift, float saturation, float lightness, float intensity, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; @@ -102,7 +102,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _saturation = Mathf.Max(0f, saturation); _lightness = Mathf.Clamp(lightness, -0.5f, 0.5f); _maxIntensity = Mathf.Clamp01(intensity); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeRequest(); @@ -132,7 +132,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindRequestIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/Letterbox/LetterboxEffect.cs b/BopVisualEffects/Effects/Letterbox/LetterboxEffect.cs index 9c18cea..915c378 100644 --- a/BopVisualEffects/Effects/Letterbox/LetterboxEffect.cs +++ b/BopVisualEffects/Effects/Letterbox/LetterboxEffect.cs @@ -33,7 +33,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["size"] = 0.1f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -46,7 +46,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var size = entity.GetFloat("size"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -73,21 +73,21 @@ private sealed class LetterboxRunner : MonoBehaviour private JukeboxScript? _jukebox; private LetterboxOverlay? _overlay; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float size, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float size, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _size = Mathf.Clamp(size, 0f, 0.49f); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeOverlay(); @@ -117,7 +117,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindOverlayIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/PixelGrid/PixelGridEffect.cs b/BopVisualEffects/Effects/PixelGrid/PixelGridEffect.cs index 57eea9c..aa05d46 100644 --- a/BopVisualEffects/Effects/PixelGrid/PixelGridEffect.cs +++ b/BopVisualEffects/Effects/PixelGrid/PixelGridEffect.cs @@ -34,7 +34,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["pixel_size"] = 4.0f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -47,7 +47,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var pixelSize = entity.GetFloat("pixel_size"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -74,21 +74,21 @@ private sealed class PixelGridRunner : MonoBehaviour private JukeboxScript? _jukebox; private PixelGridOverlay? _overlay; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float pixelSize, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float pixelSize, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _pixelSize = Mathf.Clamp(Mathf.RoundToInt(pixelSize), 2, 64); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeOverlay(); @@ -118,7 +118,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindOverlayIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/Scanlines/ScanlinesEffect.cs b/BopVisualEffects/Effects/Scanlines/ScanlinesEffect.cs index a90200c..ce4e0ba 100644 --- a/BopVisualEffects/Effects/Scanlines/ScanlinesEffect.cs +++ b/BopVisualEffects/Effects/Scanlines/ScanlinesEffect.cs @@ -35,7 +35,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) ["alpha"] = 0.35f, ["count"] = 60.0f, ["scroll_speed"] = 0.0f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -50,7 +50,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var alpha = entity.GetFloat("alpha"); var count = entity.GetFloat("count"); var scrollSpeed = entity.GetFloat("scroll_speed"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -79,14 +79,14 @@ private sealed class ScanlinesRunner : MonoBehaviour private JukeboxScript? _jukebox; private ScanlinesOverlay? _overlay; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float scrollSpeed, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float scrollSpeed, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; @@ -95,7 +95,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _alpha = Mathf.Clamp01(alpha); _count = Mathf.Clamp(Mathf.RoundToInt(count), 4, 2000); _scrollSpeed = scrollSpeed; - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeOverlay(); @@ -125,7 +125,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindOverlayIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/ScreenNoise/ScreenNoiseEffect.cs b/BopVisualEffects/Effects/ScreenNoise/ScreenNoiseEffect.cs index 6bc4045..2cb61cf 100644 --- a/BopVisualEffects/Effects/ScreenNoise/ScreenNoiseEffect.cs +++ b/BopVisualEffects/Effects/ScreenNoise/ScreenNoiseEffect.cs @@ -35,7 +35,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) ["alpha"] = 0.5f, ["count"] = 400.0f, ["size"] = 0.01f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -50,7 +50,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var alpha = entity.GetFloat("alpha"); var count = entity.GetFloat("count"); var size = entity.GetFloat("size"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -79,14 +79,14 @@ private sealed class ScreenNoiseRunner : MonoBehaviour private JukeboxScript? _jukebox; private ScreenNoiseOverlay? _overlay; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float size, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float size, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; @@ -95,7 +95,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _alpha = Mathf.Clamp01(alpha); _count = Mathf.Clamp(Mathf.RoundToInt(count), 10, 2000); _size = Mathf.Clamp(size, 0.005f, 0.1f); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeOverlay(); @@ -125,7 +125,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindOverlayIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/Sepia/SepiaEffect.cs b/BopVisualEffects/Effects/Sepia/SepiaEffect.cs index fc3642d..016b9b1 100644 --- a/BopVisualEffects/Effects/Sepia/SepiaEffect.cs +++ b/BopVisualEffects/Effects/Sepia/SepiaEffect.cs @@ -35,7 +35,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["intensity"] = 0.8f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -48,7 +48,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var intensity = entity.GetFloat("intensity"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -75,21 +75,21 @@ private sealed class SepiaRunner : MonoBehaviour private JukeboxScript? _jukebox; private Camera? _camera; private SepiaRequest? _request; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _maxIntensity = Mathf.Clamp01(intensity); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeRequest(); @@ -119,7 +119,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindRequestIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/SpeedLines/SpeedLinesEffect.cs b/BopVisualEffects/Effects/SpeedLines/SpeedLinesEffect.cs index ce0b3a9..c147192 100644 --- a/BopVisualEffects/Effects/SpeedLines/SpeedLinesEffect.cs +++ b/BopVisualEffects/Effects/SpeedLines/SpeedLinesEffect.cs @@ -39,7 +39,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) ["speed"] = 3.5f, ["reach"] = DefaultReach, ["color"] = new MixtapeEventTemplates.ColorField(Color.white), - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -56,7 +56,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var speed = entity.GetFloat("speed"); var reach = entity.GetFloat("reach"); var color = entity.GetColor("color"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -68,7 +68,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) void SpawnAction() { EffectRuntimeController.Instance.SpawnRunner(runner => - runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, count, speed, reach, color, persist, easeIn, easeOut)); + runner.Initialize(loader, loader.jukebox, startBeat, endBeat, alpha, count, speed, reach, color, persist, easeIn, easeOut)); } } @@ -86,14 +86,14 @@ private sealed class SpeedLinesRunner : MonoBehaviour private JukeboxScript? _jukebox; private Camera? _camera; private SpeedLinesRequest? _request; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float speed, float reach, Color color, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float count, float speed, float reach, Color color, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; @@ -104,7 +104,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _speed = Mathf.Max(0.1f, speed); _reach = Mathf.Clamp01(reach); _color = new Color(Mathf.Clamp01(color.r), Mathf.Clamp01(color.g), Mathf.Clamp01(color.b), Mathf.Clamp01(color.a)); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeOverlay(); @@ -134,7 +134,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindOverlayIfNeeded(); var currentBeat = _jukebox.CurrentBeat; @@ -203,6 +203,7 @@ private void ApplyRequestParameters() _request.Reach = _reach; _request.Color = _color; } + } /// diff --git a/BopVisualEffects/Effects/VerticalFlip/VerticalFlipEffect.cs b/BopVisualEffects/Effects/VerticalFlip/VerticalFlipEffect.cs index 10408b0..f297574 100644 --- a/BopVisualEffects/Effects/VerticalFlip/VerticalFlipEffect.cs +++ b/BopVisualEffects/Effects/VerticalFlip/VerticalFlipEffect.cs @@ -32,7 +32,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) resizable = true, properties = new Dictionary { - ["persist_between_minigames"] = false + ["persist_camera"] = false } }; } @@ -44,7 +44,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var startBeat = entity.beat; var endBeat = startBeat + durationBeats; - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); loader.scheduler.Schedule(startBeat, (System.Action?)SpawnAction); log.Debug($"Scheduled '{DisplayName}' from beat {startBeat:0.###} to {endBeat:0.###}."); @@ -64,17 +64,17 @@ private sealed class VerticalFlipRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float endBeat, bool persistBetweenMinigames) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float endBeat, bool persistCamera) { _loader = loader; _jukebox = jukebox; _endBeat = endBeat; - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; InitializeFlip(); } @@ -102,7 +102,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindCameraIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/Vignette/VignetteEffect.cs b/BopVisualEffects/Effects/Vignette/VignetteEffect.cs index 22aae37..a7fce10 100644 --- a/BopVisualEffects/Effects/Vignette/VignetteEffect.cs +++ b/BopVisualEffects/Effects/Vignette/VignetteEffect.cs @@ -34,7 +34,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) { ["alpha"] = 0.7f, ["size"] = 0.1f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -48,7 +48,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var durationBeats = Mathf.Max(0.01f, entity.length); var alpha = entity.GetFloat("alpha"); var size = entity.GetFloat("size"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -76,14 +76,14 @@ private sealed class VignetteRunner : MonoBehaviour private JukeboxScript? _jukebox; private VignetteOverlay? _overlay; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float size, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float alpha, float size, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; @@ -91,7 +91,7 @@ public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float _endBeat = endBeat; _alpha = Mathf.Clamp01(alpha); _size = Mathf.Clamp(size, 0f, 0.5f); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeOverlay(); @@ -121,7 +121,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindOverlayIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/ZoomIn/ZoomInEffect.cs b/BopVisualEffects/Effects/ZoomIn/ZoomInEffect.cs index 5d16701..b1ffaf8 100644 --- a/BopVisualEffects/Effects/ZoomIn/ZoomInEffect.cs +++ b/BopVisualEffects/Effects/ZoomIn/ZoomInEffect.cs @@ -33,7 +33,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["intensity"] = 0.2f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -46,7 +46,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var intensity = entity.GetFloat("intensity"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -72,21 +72,21 @@ private sealed class ZoomInRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _intensity = Mathf.Clamp(intensity, 0f, 0.99f); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeTargetCamera(); @@ -117,7 +117,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindCameraIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/BopVisualEffects/Effects/ZoomOut/ZoomOutEffect.cs b/BopVisualEffects/Effects/ZoomOut/ZoomOutEffect.cs index 9266c02..aec5ea8 100644 --- a/BopVisualEffects/Effects/ZoomOut/ZoomOutEffect.cs +++ b/BopVisualEffects/Effects/ZoomOut/ZoomOutEffect.cs @@ -33,7 +33,7 @@ public MixtapeEventTemplate CreateTemplate(string pluginGuid) properties = new Dictionary { ["intensity"] = 0.2f, - ["persist_between_minigames"] = false, + ["persist_camera"] = false, ["ease_in"] = true, ["ease_out"] = true } @@ -46,7 +46,7 @@ public bool TrySchedule(Entity entity, MixtapeLoaderCustom loader) var log = ClassLogger.GetForClass(); var durationBeats = Mathf.Max(0.01f, entity.length); var intensity = entity.GetFloat("intensity"); - var persist = entity.GetBool("persist_between_minigames", false); + var persist = entity.GetBool("persist_camera", false); var easeIn = entity.GetBool("ease_in", true); var easeOut = entity.GetBool("ease_out", true); var startBeat = entity.beat; @@ -72,21 +72,21 @@ private sealed class ZoomOutRunner : MonoBehaviour private MixtapeLoaderCustom? _loader; private JukeboxScript? _jukebox; private Camera? _camera; - private bool _persistBetweenMinigames; + private bool _persistCamera; private bool _easeIn; private bool _easeOut; /// /// Initializes this runner with effect parameters. /// - public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity, bool persistBetweenMinigames, bool easeIn, bool easeOut) + public void Initialize(MixtapeLoaderCustom loader, JukeboxScript? jukebox, float startBeat, float endBeat, float intensity, bool persistCamera, bool easeIn, bool easeOut) { _loader = loader; _jukebox = jukebox; _startBeat = startBeat; _endBeat = endBeat; _intensity = Mathf.Max(0f, intensity); - _persistBetweenMinigames = persistBetweenMinigames; + _persistCamera = persistCamera; _easeIn = easeIn; _easeOut = easeOut; InitializeTargetCamera(); @@ -117,7 +117,7 @@ private void LateUpdate() return; } - if (_persistBetweenMinigames) + if (_persistCamera) RebindCameraIfNeeded(); var currentBeat = _jukebox.CurrentBeat; diff --git a/docs/effects/README.md b/docs/effects/README.md index d4882b2..fa49b0c 100644 --- a/docs/effects/README.md +++ b/docs/effects/README.md @@ -45,7 +45,7 @@ Applies a sustained full-screen color tint that fades in, holds, then fades out. **Properties** - `color`: Tint color (default `#ff000040` — red with slight opacity). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -65,7 +65,7 @@ Draws a ground fog gradient overlay - opaque at the bottom of the screen, fading **Properties** - `color`: Fog color (default `#CCCCE599` - pale blue-gray). - `height`: Normalized screen height at which the fog fully fades to transparent (0–1; default `0.5`). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the fog lasts, in beats. This event is resizable in the timeline. @@ -102,7 +102,7 @@ Adjusts hue, saturation and lightness of the whole screen for colour grading usi - `saturation`: Saturation multiplier (0 = fully greyscale, 1 = unchanged, >1 = boosted; default `1.0`). Boost above 1 requires shader bundle. - `lightness`: Additive lightness offset (-0.5–0.5; default `0`). Positive values brighten, negative values darken. - `intensity`: Overall blend strength (0–1; default `1.0`). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -121,7 +121,7 @@ Adds cinematic black bars at the top and bottom of the screen for a dramatic wid **Properties** - `size`: Height of each bar as a normalized screen fraction (0–0.49; default `0.1`). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -140,7 +140,7 @@ Pixelates the screen by downsampling the camera's rendered output to a low-resol **Properties** - `pixel_size`: Size of each pixel block in screen pixels (2–64; default `4`). Larger values produce a more pronounced 8-bit look. -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -161,7 +161,7 @@ Draws horizontal CRT-style scan lines over the screen for a retro aesthetic. Can - `alpha`: Darkness of each scan line (0–1; default `0.35`). - `count`: Number of scan lines (default `60`, clamped 4–2000). - `scroll_speed`: Speed at which lines scroll upward, in cells per second (default `0` = static; negative = scroll downward). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -182,7 +182,7 @@ Draws animated TV static noise specks over the screen for a glitchy atmosphere. - `alpha`: Maximum opacity of the noise specks (0–1; default `0.5`). - `count`: Number of noise specks drawn per frame (10–2000; default `400`). - `size`: Physical size of each speck in normalized screen coordinates (0.005–0.1; default `0.01`). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -201,7 +201,7 @@ Applies a warm vintage sepia-tone filter using a per-pixel shader (standard Adob **Properties** - `intensity`: Strength of the sepia toning (0–1; default `0.8`). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -224,7 +224,7 @@ Draws an animated, noise-driven radial speed-line vignette. Thin colored streak - `speed`: Animation rate of the procedural noise in cycles per second (default `3.5`). Higher values produce faster-moving streaks. - `reach`: How far each speed line reaches toward the screen center as a normalized edge-to-center fraction (0–1; default `0.25`). `0` keeps the effect at the screen edge; `1` reaches the center. The calculation accounts for the screen aspect ratio. - `color`: Color and base opacity of the speed lines (default white). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade speed lines in over the first 15% of the event (default `true`). - `ease_out`: Fade speed lines out over the last 15% of the event (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -259,7 +259,7 @@ Darkens the screen edges with a smooth radial/elliptical gradient using a 32-seg **Properties** - `alpha`: Darkness of the edge (0–1; default `0.7`). - `size`: How far the darkening extends inward as a fraction of screen half-height (0–0.5; default `0.1`). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -278,7 +278,7 @@ Eases the camera smoothly into a zoomed-in view, holds at the target level, then **Properties** - `intensity`: How far to zoom in, as a fraction of the camera's base size (e.g. `0.2` = 20% closer). Clamped to `[0, 0.99]`. -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline. @@ -297,7 +297,7 @@ Eases the camera smoothly out to a wider view, holds, then eases back in. Compos **Properties** - `intensity`: How far to zoom out, as a fraction of the camera's base size (e.g. `0.2` = 20% further out). -- `persist_between_minigames`: Keep the effect attached to the active camera when the minigame changes (default `false`). +- `persist_camera`: Keep the effect attached to the active camera when the minigame changes (default `false`). - `ease_in`: Fade the effect in at the event start (default `true`). - `ease_out`: Fade the effect out at the event end (default `true`). - `length` (event length in editor): How long the effect lasts, in beats. This event is resizable in the timeline.