Clean up and fix double-starting music #2

Merged
nikita merged 15 commits from ratijas/muzika-gromche:work/r/double-trigger into master 2025-07-11 20:06:25 +00:00
1 changed files with 5 additions and 5 deletions
Showing only changes of commit 2284636576 - Show all commits

View File

@ -186,7 +186,7 @@ namespace MuzikaGromche
{ {
__state = new State __state = new State
{ {
prevStateindex = __instance.previousState previousState = __instance.previousState
}; };
if (__instance.currentBehaviourStateIndex == 2 && __instance.previousBehaviourStateIndex != 2) if (__instance.currentBehaviourStateIndex == 2 && __instance.previousBehaviourStateIndex != 2)
{ {
@ -206,7 +206,7 @@ namespace MuzikaGromche
__instance.farAudio = __state.farAudio; __instance.farAudio = __state.farAudio;
} }
if (__instance.currentBehaviourStateIndex == 1 && __state.prevStateindex != 1) if (__instance.currentBehaviourStateIndex == 1 && __state.previousState != 1)
{ {
// if just started winding up // if just started winding up
// then stop the default music... // then stop the default music...
@ -236,13 +236,13 @@ namespace MuzikaGromche
__instance.farAudio.Play(); __instance.farAudio.Play();
} }
if (__instance.currentBehaviourStateIndex == 2 && __state.prevStateindex != 2) if (__instance.currentBehaviourStateIndex == 2 && __state.previousState != 2)
{ {
__instance.creatureVoice.Stop(); __instance.creatureVoice.Stop();
Plugin.StartLightSwitching(__instance); Plugin.StartLightSwitching(__instance);
} }
if (__instance.currentBehaviourStateIndex != 2 && __state.prevStateindex == 2) if (__instance.currentBehaviourStateIndex != 2 && __state.previousState == 2)
{ {
Plugin.StopLightSwitching(__instance); Plugin.StopLightSwitching(__instance);
Plugin.ResetLightColor(); Plugin.ResetLightColor();
@ -264,6 +264,6 @@ namespace MuzikaGromche
internal class State internal class State
{ {
public AudioSource farAudio; public AudioSource farAudio;
public int prevStateindex; public int previousState;
} }
} }