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 a41734a79..b087dd82b 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 f5e544a99..3f1351d68 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 25846906c..e0a4f3464 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 ebfa93dcc..6ef7e6f3c 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 8cc6c9a4c..32435dce7 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 6eae91096..092000a5e 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 94c7a835a..83b43cea7 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 bc63e90b9..1b9c64363 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 3295b0d13..711ab0b36 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 d049af6f1..7b7fbc8ff 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 83cef6ffb..6cd8aa12d 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 b86442fc0..f9816369f 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 d2a588157..27f0e949a 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 48bf8b287..f4c22acf6 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 7adc842cc..5f9194e3f 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 e3ebbee6e..ce9c340ed 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 816a9adad..b8ef10d33 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 df0eed379..e43679f76 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 1aa0943a2..778f5208f 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 51ee57fad..6630b24e6 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 aa0e4064b..2adb2f958 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 6e964965f..0963ffb48 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 2e0e8d507..a46c9f2e9 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 db35d726f..573ba0944 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 02b30391a..8c1368448 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 298236f9a..9e0460866 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 b30ca5ead..37d669f57 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()