From bb6559fe58991acbfcd15814f85804aadd0255fc Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Sun, 4 Jun 2023 01:30:17 +0200 Subject: [PATCH] Games that override ondestroy now destroy their inputs when they are destroyed (#449) --- Assets/Scripts/Games/AirRally/AirRally.cs | 6 +++++- Assets/Scripts/Games/BlueBear/BlueBear.cs | 4 ++++ Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs | 4 ++++ Assets/Scripts/Games/CheerReaders/CheerReaders.cs | 4 ++++ Assets/Scripts/Games/DogNinja/DogNinja.cs | 4 ++++ Assets/Scripts/Games/DoubleDate/DoubleDate.cs | 4 ++++ Assets/Scripts/Games/Fireworks/Fireworks.cs | 4 ++++ Assets/Scripts/Games/FirstContact/FirstContact.cs | 4 ++++ Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs | 4 ++++ Assets/Scripts/Games/GleeClub/GleeClub.cs | 4 ++++ Assets/Scripts/Games/LaunchParty/LaunchParty.cs | 4 ++++ Assets/Scripts/Games/Lockstep/Lockstep.cs | 4 ++++ Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs | 4 ++++ Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs | 4 ++++ Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs | 5 +++++ Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs | 5 +++++ Assets/Scripts/Games/QuizShow/QuizShow.cs | 4 ++++ Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs | 4 ++++ Assets/Scripts/Games/Ringside/Ringside.cs | 4 ++++ Assets/Scripts/Games/Rockers/Rockers.cs | 4 ++++ Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs | 4 ++++ Assets/Scripts/Games/Tambourine/Tambourine.cs | 4 ++++ Assets/Scripts/Games/TapTroupe/TapTroupe.cs | 4 ++++ Assets/Scripts/Games/TheDazzles/TheDazzles.cs | 4 ++++ Assets/Scripts/Games/TrickClass/TrickClass.cs | 4 ++++ Assets/Scripts/Games/Tunnel/Tunnel.cs | 4 ++++ Assets/Scripts/Games/WorkingDough/WorkingDough.cs | 4 ++++ 27 files changed, 111 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Games/AirRally/AirRally.cs b/Assets/Scripts/Games/AirRally/AirRally.cs index a41734a7..b087dd82 100644 --- a/Assets/Scripts/Games/AirRally/AirRally.cs +++ b/Assets/Scripts/Games/AirRally/AirRally.cs @@ -109,7 +109,11 @@ namespace HeavenStudio.Games void OnDestroy() { - if (queuedVoiceLines.Count > 0) queuedVoiceLines.Clear(); + if (queuedVoiceLines.Count > 0) queuedVoiceLines.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void Start() diff --git a/Assets/Scripts/Games/BlueBear/BlueBear.cs b/Assets/Scripts/Games/BlueBear/BlueBear.cs index f5e544a9..3f1351d6 100644 --- a/Assets/Scripts/Games/BlueBear/BlueBear.cs +++ b/Assets/Scripts/Games/BlueBear/BlueBear.cs @@ -116,6 +116,10 @@ namespace HeavenStudio.Games rightCrumbAppearThreshold = 15; leftCrumbAppearThreshold = 30; eatenTreats = 0; + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Awake() diff --git a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs index 25846906..e0a4f346 100644 --- a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs +++ b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs @@ -181,6 +181,10 @@ namespace HeavenStudio.Games currentShooterColor = Color.white; currentEnvironmentColor = new Color(0, 1, 0, 1); UpdateColors(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Start() diff --git a/Assets/Scripts/Games/CheerReaders/CheerReaders.cs b/Assets/Scripts/Games/CheerReaders/CheerReaders.cs index ebfa93dc..6ef7e6f3 100644 --- a/Assets/Scripts/Games/CheerReaders/CheerReaders.cs +++ b/Assets/Scripts/Games/CheerReaders/CheerReaders.cs @@ -178,6 +178,10 @@ namespace HeavenStudio.Games void OnDestroy() { Jukebox.KillLoop(SpinningLoop, 0.5f); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } public override void OnTimeChange() diff --git a/Assets/Scripts/Games/DogNinja/DogNinja.cs b/Assets/Scripts/Games/DogNinja/DogNinja.cs index 8cc6c9a4..32435dce 100644 --- a/Assets/Scripts/Games/DogNinja/DogNinja.cs +++ b/Assets/Scripts/Games/DogNinja/DogNinja.cs @@ -185,6 +185,10 @@ namespace HeavenStudio.Games if (!Conductor.instance.isPlaying || Conductor.instance.isPaused) { if (queuedThrows.Count > 0) queuedThrows.Clear(); } + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Update() diff --git a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs index 6eae9109..092000a5 100644 --- a/Assets/Scripts/Games/DoubleDate/DoubleDate.cs +++ b/Assets/Scripts/Games/DoubleDate/DoubleDate.cs @@ -116,6 +116,10 @@ namespace HeavenStudio.Games private void OnDestroy() { queuedBalls.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Awake() diff --git a/Assets/Scripts/Games/Fireworks/Fireworks.cs b/Assets/Scripts/Games/Fireworks/Fireworks.cs index 94c7a835..83b43cea 100644 --- a/Assets/Scripts/Games/Fireworks/Fireworks.cs +++ b/Assets/Scripts/Games/Fireworks/Fireworks.cs @@ -132,6 +132,10 @@ namespace HeavenStudio.Games void OnDestroy() { if (queuedFireworks.Count > 0) queuedFireworks.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void Awake() diff --git a/Assets/Scripts/Games/FirstContact/FirstContact.cs b/Assets/Scripts/Games/FirstContact/FirstContact.cs index bc63e90b..1b9c6436 100644 --- a/Assets/Scripts/Games/FirstContact/FirstContact.cs +++ b/Assets/Scripts/Games/FirstContact/FirstContact.cs @@ -166,6 +166,10 @@ namespace HeavenStudio.Games { if (queuedInputs.Count > 0) queuedInputs.Clear(); } + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Awake() diff --git a/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs b/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs index 3295b0d1..711ab0b3 100644 --- a/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs +++ b/Assets/Scripts/Games/FlipperFlop/FlipperFlop.cs @@ -188,6 +188,10 @@ namespace HeavenStudio.Games if (queuedInputs.Count > 0) queuedInputs.Clear(); if (queuedAttentions.Count > 0) queuedAttentions.Clear(); if (queuedFlipperRollVoiceLines.Count > 0) queuedFlipperRollVoiceLines.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Update() diff --git a/Assets/Scripts/Games/GleeClub/GleeClub.cs b/Assets/Scripts/Games/GleeClub/GleeClub.cs index d049af6f..7b7fbc8f 100644 --- a/Assets/Scripts/Games/GleeClub/GleeClub.cs +++ b/Assets/Scripts/Games/GleeClub/GleeClub.cs @@ -178,6 +178,10 @@ namespace HeavenStudio.Games if (queuedSingings.Count > 0) queuedSingings.Clear(); if (queuedBatons.Count > 0) queuedBatons.Clear(); } + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void Update() diff --git a/Assets/Scripts/Games/LaunchParty/LaunchParty.cs b/Assets/Scripts/Games/LaunchParty/LaunchParty.cs index 83cef6ff..6cd8aa12 100644 --- a/Assets/Scripts/Games/LaunchParty/LaunchParty.cs +++ b/Assets/Scripts/Games/LaunchParty/LaunchParty.cs @@ -205,6 +205,10 @@ namespace HeavenStudio.Games void OnDestroy() { if (queuedRockets.Count > 0) queuedRockets.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void Awake() diff --git a/Assets/Scripts/Games/Lockstep/Lockstep.cs b/Assets/Scripts/Games/Lockstep/Lockstep.cs index b86442fc..f9816369 100644 --- a/Assets/Scripts/Games/Lockstep/Lockstep.cs +++ b/Assets/Scripts/Games/Lockstep/Lockstep.cs @@ -194,6 +194,10 @@ namespace HeavenStudio.Games void OnDestroy() { if (queuedInputs.Count > 0) queuedInputs.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void UpdateAndRenderSlaves() diff --git a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs index d2a58815..27f0e949 100644 --- a/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs +++ b/Assets/Scripts/Games/MeatGrinder/MeatGrinder.cs @@ -119,6 +119,10 @@ namespace HeavenStudio.Games if (queuedIntervals.Count > 0) queuedIntervals.Clear(); intervalStarted = false; } + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Update() diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs index 48bf8b28..f4c22acf 100644 --- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs +++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs @@ -134,6 +134,10 @@ namespace HeavenStudio.Games // these variables wouldn't get reset, even when you go in and out of unity play mode??? shouldBlip = false; stepIterate = 0; + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } public void Update() diff --git a/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs b/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs index 7adc842c..5f9194e3 100644 --- a/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs +++ b/Assets/Scripts/Games/MunchyMonk/MunchyMonk.cs @@ -244,6 +244,11 @@ namespace HeavenStudio.Games inputsTilGrow = 10; noBlush = false; disableBaby = false; + + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Update() diff --git a/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs b/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs index e3ebbee6..ce9c340e 100644 --- a/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs +++ b/Assets/Scripts/Games/OctopusMachine/OctopusMachine.cs @@ -229,6 +229,11 @@ namespace HeavenStudio.Games if (queuedPops.Count > 0) queuedPops.Clear(); mat.SetColor("_ColorAlpha", new Color(0.97f, 0.235f, 0.54f)); + + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Update() diff --git a/Assets/Scripts/Games/QuizShow/QuizShow.cs b/Assets/Scripts/Games/QuizShow/QuizShow.cs index 816a9ada..b8ef10d3 100644 --- a/Assets/Scripts/Games/QuizShow/QuizShow.cs +++ b/Assets/Scripts/Games/QuizShow/QuizShow.cs @@ -195,6 +195,10 @@ namespace HeavenStudio.Games { if (queuedInputs.Count > 0) queuedInputs.Clear(); } + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void Awake() diff --git a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs index df0eed37..e43679f7 100644 --- a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs +++ b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs @@ -269,6 +269,10 @@ namespace HeavenStudio.Games { crHandlerInstance = null; } + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } public static void SpawnHairInactive(float beat) diff --git a/Assets/Scripts/Games/Ringside/Ringside.cs b/Assets/Scripts/Games/Ringside/Ringside.cs index 1aa0943a..778f5208 100644 --- a/Assets/Scripts/Games/Ringside/Ringside.cs +++ b/Assets/Scripts/Games/Ringside/Ringside.cs @@ -164,6 +164,10 @@ namespace HeavenStudio.Games { if (queuedPoses.Count > 0) queuedPoses.Clear(); Jukebox.KillLoop(kidsLaugh, 2f); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } public override void OnTimeChange() diff --git a/Assets/Scripts/Games/Rockers/Rockers.cs b/Assets/Scripts/Games/Rockers/Rockers.cs index 51ee57fa..6630b24e 100644 --- a/Assets/Scripts/Games/Rockers/Rockers.cs +++ b/Assets/Scripts/Games/Rockers/Rockers.cs @@ -545,6 +545,10 @@ namespace HeavenStudio.Games } if (queuedCameraEvents.Count > 0) queuedCameraEvents.Clear(); if (queuedPreInterval.Count > 0) queuedPreInterval.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Update() diff --git a/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs b/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs index aa0e4064..2adb2f95 100644 --- a/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs +++ b/Assets/Scripts/Games/SneakySpirits/SneakySpirits.cs @@ -94,6 +94,10 @@ namespace HeavenStudio.Games { if (queuedGhosts.Count > 0) queuedGhosts.Clear(); Conductor.instance.SetMinigamePitch(1f); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void Awake() diff --git a/Assets/Scripts/Games/Tambourine/Tambourine.cs b/Assets/Scripts/Games/Tambourine/Tambourine.cs index 6e964965..0963ffb4 100644 --- a/Assets/Scripts/Games/Tambourine/Tambourine.cs +++ b/Assets/Scripts/Games/Tambourine/Tambourine.cs @@ -156,6 +156,10 @@ namespace HeavenStudio.Games { if (queuedInputs.Count > 0) queuedInputs.Clear(); } + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void Update() diff --git a/Assets/Scripts/Games/TapTroupe/TapTroupe.cs b/Assets/Scripts/Games/TapTroupe/TapTroupe.cs index 2e0e8d50..a46c9f2e 100644 --- a/Assets/Scripts/Games/TapTroupe/TapTroupe.cs +++ b/Assets/Scripts/Games/TapTroupe/TapTroupe.cs @@ -165,6 +165,10 @@ namespace HeavenStudio.Games if (queuedSteps.Count > 0) queuedSteps.Clear(); if (queuedTaps.Count > 0) queuedTaps.Clear(); prepareTap = false; + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } public override void OnTimeChange() diff --git a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs index db35d726..573ba094 100644 --- a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs +++ b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs @@ -209,6 +209,10 @@ namespace HeavenStudio.Games { if (queuedPoses.Count > 0) queuedPoses.Clear(); if (queuedCrouches.Count > 0) queuedCrouches.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void Awake() diff --git a/Assets/Scripts/Games/TrickClass/TrickClass.cs b/Assets/Scripts/Games/TrickClass/TrickClass.cs index 02b30391..8c136844 100644 --- a/Assets/Scripts/Games/TrickClass/TrickClass.cs +++ b/Assets/Scripts/Games/TrickClass/TrickClass.cs @@ -101,6 +101,10 @@ namespace HeavenStudio.Games void OnDestroy() { if (queuedInputs.Count > 0) queuedInputs.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Awake() diff --git a/Assets/Scripts/Games/Tunnel/Tunnel.cs b/Assets/Scripts/Games/Tunnel/Tunnel.cs index 298236f9..9e046086 100644 --- a/Assets/Scripts/Games/Tunnel/Tunnel.cs +++ b/Assets/Scripts/Games/Tunnel/Tunnel.cs @@ -85,6 +85,10 @@ namespace HeavenStudio.Games void OnDestroy() { if (queuedInputs.Count > 0) queuedInputs.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } private void Start() diff --git a/Assets/Scripts/Games/WorkingDough/WorkingDough.cs b/Assets/Scripts/Games/WorkingDough/WorkingDough.cs index b30ca5ea..37d669f5 100644 --- a/Assets/Scripts/Games/WorkingDough/WorkingDough.cs +++ b/Assets/Scripts/Games/WorkingDough/WorkingDough.cs @@ -477,6 +477,10 @@ namespace HeavenStudio.Games { if (queuedIntervals.Count > 0) queuedIntervals.Clear(); if (queuedBalls.Count > 0) queuedBalls.Clear(); + foreach (var evt in scheduledInputs) + { + evt.Disable(); + } } void Update()