Work on upcoming notes, reworked active notes a bit

This commit is contained in:
Thastertyn committed 2024-06-15 21:03:21 +02:00
1 parent e56da61974
commit e1dbbafe99
5 files changed
+139 -16

No files matched your search

+11 -8
View File
@@ -8,6 +8,7 @@ using System.Linq;
using UITypes;
using BangerTypes;
using Unity.VisualScripting;
public class Game : MonoBehaviour
{
@@ -23,7 +24,9 @@ public class Game : MonoBehaviour
Song song = null;
Note[] activeNotes;
List<Note> allNotes = new();
List<Note> activeNotes = new();
void Awake()
{
@@ -47,14 +50,12 @@ public class Game : MonoBehaviour
{
float timestamp = manager.source.time;
activeNotes = song.Notes.Where(note => note.t >= timestamp && timestamp + 1f <= note.t).ToArray();
List<Note> newNotes = allNotes.Where(note => note.t >= timestamp && timestamp + 1f <= note.t).ToList();
newNotes.ForEach(note => activeNotes.Remove(note));
if(activeNotes.Length > 0)
{
Debug.Log("Found some notes");
}
menu.GameElem.UpdateNotes(activeNotes);
menu.GameElem.CheckNoteSelf(timestamp);
menu.GameElem.UpdateMargin(timestamp);
menu.GameElem.UpdateNotes(newNotes);
}
IEnumerator GameLoop()
@@ -69,6 +70,8 @@ public class Game : MonoBehaviour
public void LoadSong(SongEntry song)
{
this.song = song.Song;
allNotes = this.song.Notes.ToList();
totalDuration = song.Song.Duration;
manager.source.clip = song.Song.Clip;