fix track gap and durochka sound level

This commit is contained in:
Nikita Vilunov 2024-10-29 13:37:32 +01:00
parent 4558a4d942
commit 8518e0f62d
3 changed files with 16 additions and 16 deletions

BIN
Assets/DurochkaLoop.mp3 (Stored with Git LFS)

Binary file not shown.

BIN
Assets/DurochkaStart.mp3 (Stored with Git LFS)

Binary file not shown.

View File

@ -142,11 +142,8 @@ namespace MuzikaGromche
// if just started winding up // if just started winding up
// then stop the default music... // then stop the default music...
__instance.farAudio.Stop(); __instance.farAudio.Stop();
__instance.farAudio.Pause(); __instance.creatureVoice.Stop();
}
if (__instance.currentBehaviourStateIndex is 1 && !__instance.farAudio.isPlaying)
{
// ...and start modded music // ...and start modded music
var seed = RoundManager.Instance.dungeonGenerator.Generator.ChosenSeed; var seed = RoundManager.Instance.dungeonGenerator.Generator.ChosenSeed;
var sha = SHA256.Create(); var sha = SHA256.Create();
@ -163,9 +160,11 @@ namespace MuzikaGromche
Debug.Log($"Seed is {seed}, chosen track is {trackId} out of {Plugin.Tracks.Length} tracks"); Debug.Log($"Seed is {seed}, chosen track is {trackId} out of {Plugin.Tracks.Length} tracks");
Plugin.CurrentTrack = Plugin.Tracks[trackId]; Plugin.CurrentTrack = Plugin.Tracks[trackId];
__instance.popUpTimer = Plugin.CurrentTrack.WindUpTimer; __instance.popUpTimer = Plugin.CurrentTrack.WindUpTimer;
Debug.Log($"Playing start music: maxDistance: {__instance.farAudio.maxDistance}, minDistance: {__instance.farAudio.minDistance}, volume: {__instance.farAudio.volume}, spread: {__instance.farAudio.spread}");
__instance.farAudio.maxDistance = 150; __instance.farAudio.maxDistance = 150;
__instance.farAudio.PlayOneShot(Plugin.CurrentTrack.LoadedStart); __instance.farAudio.clip = Plugin.CurrentTrack.LoadedStart;
__instance.farAudio.loop = false;
Debug.Log($"Playing start music: maxDistance: {__instance.farAudio.maxDistance}, minDistance: {__instance.farAudio.minDistance}, volume: {__instance.farAudio.volume}, spread: {__instance.farAudio.spread}");
__instance.farAudio.Play();
} }
if (__instance.currentBehaviourStateIndex is 2 && __state.prevStateindex != 2) if (__instance.currentBehaviourStateIndex is 2 && __state.prevStateindex != 2)
@ -176,8 +175,6 @@ namespace MuzikaGromche
__instance.StopCoroutine(Plugin.JesterLightSwitching); __instance.StopCoroutine(Plugin.JesterLightSwitching);
Plugin.JesterLightSwitching = null; Plugin.JesterLightSwitching = null;
} }
Plugin.JesterLightSwitching = __instance.StartCoroutine(rotateColors()); Plugin.JesterLightSwitching = __instance.StartCoroutine(rotateColors());
} }
@ -193,12 +190,15 @@ namespace MuzikaGromche
} }
} }
if (__instance.currentBehaviourStateIndex is 2 && !__instance.creatureVoice.isPlaying && !__instance.farAudio.isPlaying) if (__instance.currentBehaviourStateIndex is 2 && !__instance.creatureVoice.isPlaying)
{ {
Debug.Log($"Playing loop music: maxDistance: {__instance.creatureVoice.maxDistance}, minDistance: {__instance.creatureVoice.minDistance}, volume: {__instance.creatureVoice.volume}, spread: {__instance.creatureVoice.spread}");
__instance.creatureVoice.maxDistance = 150; __instance.creatureVoice.maxDistance = 150;
__instance.creatureVoice.clip = Plugin.CurrentTrack.LoadedLoop; __instance.creatureVoice.clip = Plugin.CurrentTrack.LoadedLoop;
__instance.creatureVoice.Play(); var time = __instance.farAudio.time;
var delay = Plugin.CurrentTrack.LoadedStart.length - time;
Debug.Log($"Start length: {Plugin.CurrentTrack.LoadedStart.length}; played time: {time}");
Debug.Log($"Playing loop music: maxDistance: {__instance.creatureVoice.maxDistance}, minDistance: {__instance.creatureVoice.minDistance}, volume: {__instance.creatureVoice.volume}, spread: {__instance.creatureVoice.spread}, in seconds: {delay}");
__instance.creatureVoice.PlayDelayed(delay);
} }
} }
} }