Compare commits

..

2 Commits

Author SHA1 Message Date
Nikita Vilunov 89a41f9640 "new" track 2024-10-28 21:06:07 +01:00
Nikita Vilunov 987fe830c3 fix some stuff ok? 2024-04-26 23:40:35 +02:00
1 changed files with 22 additions and 1 deletions

View File

@ -16,13 +16,19 @@ namespace MuzikaGromche
{
Name = "MuzikaGromche",
WindUpTimer = 46.3f,
Bpm = 120f,
Bpm = 130f,
},
new Track
{
Name = "VseVZale",
WindUpTimer = 39f,
Bpm = 138f,
},
new Track
{
Name = "DeployDestroy",
WindUpTimer = 40.7f,
Bpm = 130f,
}
];
@ -73,6 +79,12 @@ namespace MuzikaGromche
{
__state = new State();
__state.prevStateindex = __instance.previousState;
if (__instance.currentBehaviourStateIndex == 2 && __instance.previousBehaviourStateIndex != 2) {
// if just popped out
// then override farAudio so that vanilla logic does not stop the music
__state.farAudio = __instance.farAudio;
__instance.farAudio = __instance.creatureVoice;
}
}
static List<Color> colors = [Color.magenta, Color.cyan, Color.green, Color.yellow];
@ -100,14 +112,22 @@ namespace MuzikaGromche
[HarmonyPostfix]
public static void DoNotStopTheMusic(JesterAI __instance, State __state)
{
if (__state.farAudio != null)
{
__instance.farAudio = __state.farAudio;
}
if (__instance.currentBehaviourStateIndex is 1 && __state.prevStateindex != 1)
{
// if just started winding up
// then stop the default music...
__instance.farAudio.Stop();
__instance.farAudio.Pause();
}
if (__instance.currentBehaviourStateIndex is 1 && !__instance.farAudio.isPlaying)
{
// ...and start modded music
var seed = RoundManager.Instance.dungeonGenerator.Generator.ChosenSeed;
var trackId = seed % Plugin.Tracks.Length;
Debug.Log($"Seed is {seed}, chosen track is {trackId} out of {Plugin.Tracks.Length} tracks");
@ -155,6 +175,7 @@ namespace MuzikaGromche
internal class State
{
public AudioSource farAudio;
public int prevStateindex;
}
}