From c74c50d61504e1de446c1751b4e9c9ead4727897 Mon Sep 17 00:00:00 2001 From: Tugushev Damir Rustamovich <0damir.1tugushev@gmail.com> Date: Fri, 8 Nov 2024 22:03:44 +0300 Subject: [PATCH] =?UTF-8?q?Fixed=20issue=20with=20spawning=20the=20first?= =?UTF-8?q?=20notes=20(`Start()`=20fixed=20by=20@vesania6768=20and=20`Upda?= =?UTF-8?q?te()`=20fixed=20by=20@Dr3amB3ast=20=E2=80=93=20go=20check=20You?= =?UTF-8?q?Tube=20comments=20in=20video=20for=20original=20repo)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Note.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Note.cs b/Assets/Scripts/Note.cs index c0051b03..7abbe3f0 100644 --- a/Assets/Scripts/Note.cs +++ b/Assets/Scripts/Note.cs @@ -8,15 +8,18 @@ public class Note : MonoBehaviour public float assignedTime; void Start() { - timeInstantiated = SongManager.GetAudioSourceTime(); + timeInstantiated = assignedTime - SongManager.Instance.noteTime; } // Update is called once per frame void Update() { - double timeSinceInstantiated = SongManager.GetAudioSourceTime() - timeInstantiated; + float spawnDelay = SongManager.Instance.songDelayInSeconds - SongManager.Instance.noteTime; + double timeSinceInstantiated = spawnDelay > 0 && timeInstantiated < 0 + ? (Time.timeSinceLevelLoad - spawnDelay) + timeInstantiated + : SongManager.GetAudioSourceTime() - timeInstantiated; + float t = (float)(timeSinceInstantiated / (SongManager.Instance.noteTime * 2)); - if (t > 1) {