diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs index 14005ff1..94a40721 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbNightWalk.cs @@ -559,7 +559,6 @@ namespace HeavenStudio.Games } else { - allEnds.Sort((x, y) => x.beat.CompareTo(y.beat)); double nextSwitchBeat = double.MaxValue; foreach (var end in allEnds) { @@ -570,19 +569,11 @@ namespace HeavenStudio.Games break; } } - List tempEvents = new(); - foreach (var countIn in countInEvents) + var lastCountIn = countInEvents.FindLast(e => e.beat < nextSwitchBeat && e.beat + e.length >= beat); + if (lastCountIn != null) { - if (countIn.beat < nextSwitchBeat) - { - tempEvents.Add(countIn); - } - } - if (tempEvents.Count > 0) - { - tempEvents.Sort((x, y) => x.beat.CompareTo(y.beat)); - countInBeat = tempEvents[tempEvents.Count - 1].beat; - countInLength = tempEvents[tempEvents.Count - 1].length; + countInBeat = lastCountIn.beat; + countInLength = lastCountIn.length; } } } diff --git a/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs b/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs index a3d548b9..7554da59 100644 --- a/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs +++ b/Assets/Scripts/Games/NightWalkAgb/AgbPlatformHandler.cs @@ -35,6 +35,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk public void SpawnPlatforms(double beat) { + Debug.Log("game.countInBeat : " + game.countInBeat); if (game.countInBeat != double.MinValue) { for (int i = 0; i < platformCount; i++)