MetalButtplug/Patches/UpdateBeat.cs

24 lines
908 B
C#
Raw Permalink Normal View History

2024-05-20 14:10:13 +00:00
using HarmonyLib;
2024-05-20 19:30:27 +00:00
using MetalButtplug.Utils;
2024-05-20 14:10:13 +00:00
namespace MetalButtplug.Patches;
[HarmonyPatch(typeof(BeatSequencer), nameof(BeatSequencer.UpdateBeat))]
internal class UpdateBeatPatch {
private static void Prefix(BeatStatusProvider beatStatus) {
if (beatStatus.BeatFlags.HasFlag(BeatFlags.Quarter)) {
var playerController = UnityEngine.Object.FindObjectOfType<FirstPersonController>();
var player = playerController.m_player;
var controller = player.ScoreController;
Plugin.Log.LogInfo(
2024-05-20 19:30:27 +00:00
$"Quarter beat, multiplier: {controller.GetCurrentTierIndex()}/{controller.GetNumTiers()-1} ({1 << controller.GetCurrentTierIndex()}x)"
2024-05-20 14:10:13 +00:00
);
2024-05-20 21:55:16 +00:00
var scoreMultiplier = (float)controller.GetCurrentTierIndex() / ((float)controller.GetNumTiers() - 1);
ButtplugManager.Vibrate(scoreMultiplier, 100);
2024-05-20 19:30:27 +00:00
2024-05-20 14:10:13 +00:00
}
}
}