From d8dbd1f44c4144ab6d5924ae343f77407e5cd9c4 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Tue, 28 Jun 2022 16:58:23 -0400 Subject: [PATCH] tempo change: clamp on scroll --- Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs | 5 +++++ Assets/Scripts/LevelEditor/Timeline/TempoTimelineObj.cs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs b/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs index cbd67a541..6e7a40621 100644 --- a/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs @@ -72,6 +72,7 @@ namespace HeavenStudio.Editor.Track GameManager.instance.Beatmap.bpm += increase; UpdateStartingBPMText(); UpdateStartingBPMFromText(); // In case the scrolled-to value is invalid. + } } } @@ -109,6 +110,8 @@ namespace HeavenStudio.Editor.Track // In case the newBPM ended up differing from the inputted string. UpdateStartingBPMText(); + + Timeline.instance.FitToSong(); } public void UpdateOffsetFromText() @@ -160,6 +163,8 @@ namespace HeavenStudio.Editor.Track } tempoTimelineObjs.Add(tempoTimelineObj); + + Timeline.instance.FitToSong(); } } diff --git a/Assets/Scripts/LevelEditor/Timeline/TempoTimelineObj.cs b/Assets/Scripts/LevelEditor/Timeline/TempoTimelineObj.cs index a0edf741f..8e48f86b2 100644 --- a/Assets/Scripts/LevelEditor/Timeline/TempoTimelineObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/TempoTimelineObj.cs @@ -46,6 +46,10 @@ namespace HeavenStudio.Editor.Track tempoChange.tempo += newTempo; + //make sure tempo is positive + if (tempoChange.tempo < 1) + tempoChange.tempo = 1; + if (Input.GetMouseButtonDown(0)) { Vector3 mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition); @@ -96,6 +100,7 @@ namespace HeavenStudio.Editor.Track private void UpdateTempo() { tempoTXT.text = $"{tempoChange.tempo} BPM"; + Timeline.instance.FitToSong(); } } } \ No newline at end of file