public void RunActions(BeatKeeper parent) { // Run actions OnRepeat?.Invoke(parent, this); // Run action before resetting event OnOnce?.Invoke(parent, this); OnOnce = null; // Setup for the next beat double cacheToSetLastTrigger = NextTrigger; while (IsOnBeat(parent)) { NextTrigger += Interval.ConvertBeat(parent.regularBeat); // Check if next trigger exceeds music length if (NextTrigger > parent.music.clip.length) { // Reset the next trigger to the start of the music NextTrigger = parent.firstBeat; } } LastTrigger = cacheToSetLastTrigger; //Debug.Log($"Last: {LastTrigger}, Next: {NextTrigger}"); }
public BeatStats(BeatKeeper parent, Interval interval) { // Setup interval Interval = interval; LastTrigger = parent.firstBeat; NextTrigger = (parent.firstBeat + Interval.ConvertBeat(parent.regularBeat)); }