forked from nikita/muzika-gromche
Fix double triggering start of music
State transitions are only handled by changes to previousState on per-frame basis, so only compare before/after of previousState.
This commit is contained in:
parent
2284636576
commit
9176e35344
|
@ -188,7 +188,7 @@ namespace MuzikaGromche
|
|||
{
|
||||
previousState = __instance.previousState
|
||||
};
|
||||
if (__instance.currentBehaviourStateIndex == 2 && __instance.previousBehaviourStateIndex != 2)
|
||||
if (__instance.currentBehaviourStateIndex == 2 && __instance.previousState != 2)
|
||||
{
|
||||
// if just popped out
|
||||
// then override farAudio so that vanilla logic does not stop the music
|
||||
|
@ -206,7 +206,7 @@ namespace MuzikaGromche
|
|||
__instance.farAudio = __state.farAudio;
|
||||
}
|
||||
|
||||
if (__instance.currentBehaviourStateIndex == 1 && __state.previousState != 1)
|
||||
if (__instance.previousState == 1 && __state.previousState != 1)
|
||||
{
|
||||
// if just started winding up
|
||||
// then stop the default music...
|
||||
|
@ -236,19 +236,19 @@ namespace MuzikaGromche
|
|||
__instance.farAudio.Play();
|
||||
}
|
||||
|
||||
if (__instance.currentBehaviourStateIndex == 2 && __state.previousState != 2)
|
||||
if (__instance.previousState == 2 && __state.previousState != 2)
|
||||
{
|
||||
__instance.creatureVoice.Stop();
|
||||
Plugin.StartLightSwitching(__instance);
|
||||
}
|
||||
|
||||
if (__instance.currentBehaviourStateIndex != 2 && __state.previousState == 2)
|
||||
if (__instance.previousState != 2 && __state.previousState == 2)
|
||||
{
|
||||
Plugin.StopLightSwitching(__instance);
|
||||
Plugin.ResetLightColor();
|
||||
}
|
||||
|
||||
if (__instance.currentBehaviourStateIndex == 2 && !__instance.creatureVoice.isPlaying)
|
||||
if (__instance.previousState == 2 && !__instance.creatureVoice.isPlaying)
|
||||
{
|
||||
__instance.creatureVoice.maxDistance = 150;
|
||||
__instance.creatureVoice.clip = Plugin.CurrentTrack.LoadedLoop;
|
||||
|
|
Loading…
Reference in New Issue