From ece3aed81f2430a6996679952868c0bb05665b38 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Mon, 26 Jun 2023 09:55:58 +0200 Subject: [PATCH] Another small fix to roll cue sound logic --- Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs index d3085c500..2026d65f0 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs @@ -339,11 +339,21 @@ namespace HeavenStudio.Games if (end.beat <= entity.beat) tempEnds.Add(end); } } + List tempEnds2 = new(); + foreach (var end in tempEnds) + { + if (end.beat <= entity.beat) tempEnds2.Add(end); + } double lastSwitchBeat = double.MinValue; - if (tempEnds.Count > 0) + if (tempEnds2.Count > 0) + { + tempEnds2.Sort((x, y) => x.beat.CompareTo(y.beat)); + lastSwitchBeat = tempEnds2[^1].beat; + } + else if (tempEnds.Count > 0) { tempEnds.Sort((x, y) => x.beat.CompareTo(y.beat)); - lastSwitchBeat = tempEnds[^1].beat; + lastSwitchBeat = tempEnds[0].beat; } double countInBeat = double.MinValue; float countInLength = 0;