Compare commits
2 Commits
67e0063464
...
89a41f9640
Author | SHA1 | Date |
---|---|---|
Nikita Vilunov | 89a41f9640 | |
Nikita Vilunov | 987fe830c3 |
|
@ -16,13 +16,19 @@ namespace MuzikaGromche
|
||||||
{
|
{
|
||||||
Name = "MuzikaGromche",
|
Name = "MuzikaGromche",
|
||||||
WindUpTimer = 46.3f,
|
WindUpTimer = 46.3f,
|
||||||
Bpm = 120f,
|
Bpm = 130f,
|
||||||
},
|
},
|
||||||
new Track
|
new Track
|
||||||
{
|
{
|
||||||
Name = "VseVZale",
|
Name = "VseVZale",
|
||||||
WindUpTimer = 39f,
|
WindUpTimer = 39f,
|
||||||
Bpm = 138f,
|
Bpm = 138f,
|
||||||
|
},
|
||||||
|
new Track
|
||||||
|
{
|
||||||
|
Name = "DeployDestroy",
|
||||||
|
WindUpTimer = 40.7f,
|
||||||
|
Bpm = 130f,
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -73,6 +79,12 @@ namespace MuzikaGromche
|
||||||
{
|
{
|
||||||
__state = new State();
|
__state = new State();
|
||||||
__state.prevStateindex = __instance.previousState;
|
__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];
|
static List<Color> colors = [Color.magenta, Color.cyan, Color.green, Color.yellow];
|
||||||
|
@ -100,14 +112,22 @@ namespace MuzikaGromche
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
public static void DoNotStopTheMusic(JesterAI __instance, State __state)
|
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 (__instance.currentBehaviourStateIndex is 1 && __state.prevStateindex != 1)
|
||||||
{
|
{
|
||||||
|
// if just started winding up
|
||||||
|
// then stop the default music...
|
||||||
__instance.farAudio.Stop();
|
__instance.farAudio.Stop();
|
||||||
__instance.farAudio.Pause();
|
__instance.farAudio.Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__instance.currentBehaviourStateIndex is 1 && !__instance.farAudio.isPlaying)
|
if (__instance.currentBehaviourStateIndex is 1 && !__instance.farAudio.isPlaying)
|
||||||
{
|
{
|
||||||
|
// ...and start modded music
|
||||||
var seed = RoundManager.Instance.dungeonGenerator.Generator.ChosenSeed;
|
var seed = RoundManager.Instance.dungeonGenerator.Generator.ChosenSeed;
|
||||||
var trackId = seed % Plugin.Tracks.Length;
|
var trackId = seed % Plugin.Tracks.Length;
|
||||||
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");
|
||||||
|
@ -155,6 +175,7 @@ namespace MuzikaGromche
|
||||||
|
|
||||||
internal class State
|
internal class State
|
||||||
{
|
{
|
||||||
|
public AudioSource farAudio;
|
||||||
public int prevStateindex;
|
public int prevStateindex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue