Compare commits

..

No commits in common. "8518e0f62d7923e906393adf3f2c4a34563bbcd8" and "89a41f96407c8989cf807ac6cdb44a7c63c52acc" have entirely different histories.

9 changed files with 15 additions and 69 deletions

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

View File

@ -1,8 +1,6 @@
using System; using System.Collections;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Cryptography;
using BepInEx; using BepInEx;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
@ -23,7 +21,7 @@ namespace MuzikaGromche
new Track new Track
{ {
Name = "VseVZale", Name = "VseVZale",
WindUpTimer = 39f, WindUpTimer = 39f,
Bpm = 138f, Bpm = 138f,
}, },
new Track new Track
@ -31,24 +29,6 @@ namespace MuzikaGromche
Name = "DeployDestroy", Name = "DeployDestroy",
WindUpTimer = 40.7f, WindUpTimer = 40.7f,
Bpm = 130f, Bpm = 130f,
},
new Track
{
Name = "MoyaZhittya",
WindUpTimer = 34.5f,
Bpm = 120f,
},
new Track
{
Name = "Gorgorod",
WindUpTimer = 43.2f,
Bpm = 180f,
},
new Track
{
Name = "Durochka",
WindUpTimer = 37f,
Bpm = 130f,
} }
]; ];
@ -142,29 +122,20 @@ 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.creatureVoice.Stop(); __instance.farAudio.Pause();
}
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 trackId = seed % Plugin.Tracks.Length;
var hash = sha.ComputeHash(BitConverter.GetBytes(seed));
var trackId = 0;
foreach (var t in hash)
{
// modulus division on byte array
trackId *= 256 % Plugin.Tracks.Length;
trackId %= Plugin.Tracks.Length;
trackId += t % Plugin.Tracks.Length;
trackId %= 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");
Plugin.CurrentTrack = Plugin.Tracks[trackId]; Plugin.CurrentTrack = Plugin.Tracks[trackId];
__instance.popUpTimer = Plugin.CurrentTrack.WindUpTimer; __instance.popUpTimer = Plugin.CurrentTrack.WindUpTimer;
__instance.farAudio.maxDistance = 150;
__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}"); Debug.Log($"Playing start music: maxDistance: {__instance.farAudio.maxDistance}, minDistance: {__instance.farAudio.minDistance}, volume: {__instance.farAudio.volume}, spread: {__instance.farAudio.spread}");
__instance.farAudio.Play(); __instance.farAudio.maxDistance = 150;
__instance.farAudio.PlayOneShot(Plugin.CurrentTrack.LoadedStart);
} }
if (__instance.currentBehaviourStateIndex is 2 && __state.prevStateindex != 2) if (__instance.currentBehaviourStateIndex is 2 && __state.prevStateindex != 2)
@ -175,6 +146,8 @@ 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());
} }
@ -190,15 +163,12 @@ namespace MuzikaGromche
} }
} }
if (__instance.currentBehaviourStateIndex is 2 && !__instance.creatureVoice.isPlaying) if (__instance.currentBehaviourStateIndex is 2 && !__instance.creatureVoice.isPlaying && !__instance.farAudio.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;
var time = __instance.farAudio.time; __instance.creatureVoice.Play();
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);
} }
} }
} }