Games that override ondestroy now destroy their inputs when they are destroyed (#449)

This commit is contained in:
Rapandrasmus 2023-06-04 01:30:17 +02:00 committed by GitHub
parent cc787c5f36
commit f0b68bdcd1
27 changed files with 111 additions and 1 deletions

View file

@ -110,6 +110,10 @@ namespace HeavenStudio.Games
void OnDestroy() void OnDestroy()
{ {
if (queuedVoiceLines.Count > 0) queuedVoiceLines.Clear(); if (queuedVoiceLines.Count > 0) queuedVoiceLines.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void Start() void Start()

View file

@ -116,6 +116,10 @@ namespace HeavenStudio.Games
rightCrumbAppearThreshold = 15; rightCrumbAppearThreshold = 15;
leftCrumbAppearThreshold = 30; leftCrumbAppearThreshold = 30;
eatenTreats = 0; eatenTreats = 0;
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Awake() private void Awake()

View file

@ -181,6 +181,10 @@ namespace HeavenStudio.Games
currentShooterColor = Color.white; currentShooterColor = Color.white;
currentEnvironmentColor = new Color(0, 1, 0, 1); currentEnvironmentColor = new Color(0, 1, 0, 1);
UpdateColors(); UpdateColors();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Start() private void Start()

View file

@ -178,6 +178,10 @@ namespace HeavenStudio.Games
void OnDestroy() void OnDestroy()
{ {
Jukebox.KillLoop(SpinningLoop, 0.5f); Jukebox.KillLoop(SpinningLoop, 0.5f);
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
public override void OnTimeChange() public override void OnTimeChange()

View file

@ -185,6 +185,10 @@ namespace HeavenStudio.Games
if (!Conductor.instance.isPlaying || Conductor.instance.isPaused) { if (!Conductor.instance.isPlaying || Conductor.instance.isPaused) {
if (queuedThrows.Count > 0) queuedThrows.Clear(); if (queuedThrows.Count > 0) queuedThrows.Clear();
} }
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Update() private void Update()

View file

@ -116,6 +116,10 @@ namespace HeavenStudio.Games
private void OnDestroy() { private void OnDestroy() {
queuedBalls.Clear(); queuedBalls.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Awake() private void Awake()

View file

@ -132,6 +132,10 @@ namespace HeavenStudio.Games
void OnDestroy() void OnDestroy()
{ {
if (queuedFireworks.Count > 0) queuedFireworks.Clear(); if (queuedFireworks.Count > 0) queuedFireworks.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void Awake() void Awake()

View file

@ -166,6 +166,10 @@ namespace HeavenStudio.Games
{ {
if (queuedInputs.Count > 0) queuedInputs.Clear(); if (queuedInputs.Count > 0) queuedInputs.Clear();
} }
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Awake() private void Awake()

View file

@ -188,6 +188,10 @@ namespace HeavenStudio.Games
if (queuedInputs.Count > 0) queuedInputs.Clear(); if (queuedInputs.Count > 0) queuedInputs.Clear();
if (queuedAttentions.Count > 0) queuedAttentions.Clear(); if (queuedAttentions.Count > 0) queuedAttentions.Clear();
if (queuedFlipperRollVoiceLines.Count > 0) queuedFlipperRollVoiceLines.Clear(); if (queuedFlipperRollVoiceLines.Count > 0) queuedFlipperRollVoiceLines.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Update() private void Update()

View file

@ -178,6 +178,10 @@ namespace HeavenStudio.Games
if (queuedSingings.Count > 0) queuedSingings.Clear(); if (queuedSingings.Count > 0) queuedSingings.Clear();
if (queuedBatons.Count > 0) queuedBatons.Clear(); if (queuedBatons.Count > 0) queuedBatons.Clear();
} }
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void Update() void Update()

View file

@ -205,6 +205,10 @@ namespace HeavenStudio.Games
void OnDestroy() void OnDestroy()
{ {
if (queuedRockets.Count > 0) queuedRockets.Clear(); if (queuedRockets.Count > 0) queuedRockets.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void Awake() void Awake()

View file

@ -194,6 +194,10 @@ namespace HeavenStudio.Games
void OnDestroy() void OnDestroy()
{ {
if (queuedInputs.Count > 0) queuedInputs.Clear(); if (queuedInputs.Count > 0) queuedInputs.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void UpdateAndRenderSlaves() void UpdateAndRenderSlaves()

View file

@ -119,6 +119,10 @@ namespace HeavenStudio.Games
if (queuedIntervals.Count > 0) queuedIntervals.Clear(); if (queuedIntervals.Count > 0) queuedIntervals.Clear();
intervalStarted = false; intervalStarted = false;
} }
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Update() private void Update()

View file

@ -134,6 +134,10 @@ namespace HeavenStudio.Games
// these variables wouldn't get reset, even when you go in and out of unity play mode??? // these variables wouldn't get reset, even when you go in and out of unity play mode???
shouldBlip = false; shouldBlip = false;
stepIterate = 0; stepIterate = 0;
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
public void Update() public void Update()

View file

@ -244,6 +244,11 @@ namespace HeavenStudio.Games
inputsTilGrow = 10; inputsTilGrow = 10;
noBlush = false; noBlush = false;
disableBaby = false; disableBaby = false;
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Update() private void Update()

View file

@ -229,6 +229,11 @@ namespace HeavenStudio.Games
if (queuedPops.Count > 0) queuedPops.Clear(); if (queuedPops.Count > 0) queuedPops.Clear();
mat.SetColor("_ColorAlpha", new Color(0.97f, 0.235f, 0.54f)); mat.SetColor("_ColorAlpha", new Color(0.97f, 0.235f, 0.54f));
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Update() private void Update()

View file

@ -195,6 +195,10 @@ namespace HeavenStudio.Games
{ {
if (queuedInputs.Count > 0) queuedInputs.Clear(); if (queuedInputs.Count > 0) queuedInputs.Clear();
} }
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void Awake() void Awake()

View file

@ -269,6 +269,10 @@ namespace HeavenStudio.Games
{ {
crHandlerInstance = null; crHandlerInstance = null;
} }
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
public static void SpawnHairInactive(float beat) public static void SpawnHairInactive(float beat)

View file

@ -164,6 +164,10 @@ namespace HeavenStudio.Games
{ {
if (queuedPoses.Count > 0) queuedPoses.Clear(); if (queuedPoses.Count > 0) queuedPoses.Clear();
Jukebox.KillLoop(kidsLaugh, 2f); Jukebox.KillLoop(kidsLaugh, 2f);
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
public override void OnTimeChange() public override void OnTimeChange()

View file

@ -545,6 +545,10 @@ namespace HeavenStudio.Games
} }
if (queuedCameraEvents.Count > 0) queuedCameraEvents.Clear(); if (queuedCameraEvents.Count > 0) queuedCameraEvents.Clear();
if (queuedPreInterval.Count > 0) queuedPreInterval.Clear(); if (queuedPreInterval.Count > 0) queuedPreInterval.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Update() private void Update()

View file

@ -94,6 +94,10 @@ namespace HeavenStudio.Games
{ {
if (queuedGhosts.Count > 0) queuedGhosts.Clear(); if (queuedGhosts.Count > 0) queuedGhosts.Clear();
Conductor.instance.SetMinigamePitch(1f); Conductor.instance.SetMinigamePitch(1f);
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void Awake() void Awake()

View file

@ -156,6 +156,10 @@ namespace HeavenStudio.Games
{ {
if (queuedInputs.Count > 0) queuedInputs.Clear(); if (queuedInputs.Count > 0) queuedInputs.Clear();
} }
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void Update() void Update()

View file

@ -165,6 +165,10 @@ namespace HeavenStudio.Games
if (queuedSteps.Count > 0) queuedSteps.Clear(); if (queuedSteps.Count > 0) queuedSteps.Clear();
if (queuedTaps.Count > 0) queuedTaps.Clear(); if (queuedTaps.Count > 0) queuedTaps.Clear();
prepareTap = false; prepareTap = false;
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
public override void OnTimeChange() public override void OnTimeChange()

View file

@ -209,6 +209,10 @@ namespace HeavenStudio.Games
{ {
if (queuedPoses.Count > 0) queuedPoses.Clear(); if (queuedPoses.Count > 0) queuedPoses.Clear();
if (queuedCrouches.Count > 0) queuedCrouches.Clear(); if (queuedCrouches.Count > 0) queuedCrouches.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void Awake() void Awake()

View file

@ -101,6 +101,10 @@ namespace HeavenStudio.Games
void OnDestroy() void OnDestroy()
{ {
if (queuedInputs.Count > 0) queuedInputs.Clear(); if (queuedInputs.Count > 0) queuedInputs.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Awake() private void Awake()

View file

@ -85,6 +85,10 @@ namespace HeavenStudio.Games
void OnDestroy() void OnDestroy()
{ {
if (queuedInputs.Count > 0) queuedInputs.Clear(); if (queuedInputs.Count > 0) queuedInputs.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
private void Start() private void Start()

View file

@ -477,6 +477,10 @@ namespace HeavenStudio.Games
{ {
if (queuedIntervals.Count > 0) queuedIntervals.Clear(); if (queuedIntervals.Count > 0) queuedIntervals.Clear();
if (queuedBalls.Count > 0) queuedBalls.Clear(); if (queuedBalls.Count > 0) queuedBalls.Clear();
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
} }
void Update() void Update()