Esempio n. 1
0
    void Update()
    {
        if (isMusingStarted)
        {
            double time = AudioSettings.dspTime - musicStartTime + debugStartTime;
            while (beatIndex < BeatData.beatTimes.Count &&
                   BeatData.beatTimes[beatIndex] - Beat.ShrinkTime <= time)
            {
                SpawnBeat(BeatData.beatTimes[beatIndex]);
                beatIndex++;
            }

            while (sliderIndex < BeatData.sliderTimes.Count &&
                   BeatData.sliderTimes[sliderIndex].startTime - Beat.ShrinkTime <= time)
            {
                SpawnSlider(BeatData.sliderTimes[sliderIndex]);
                sliderIndex++;
            }

            for (int i = beats.Count - 1; i >= 0; i--)
            {
                Beat beat = beats[i];
                beat.UpdateTime(time);
                if (beat.IsDone)
                {
                    beats.RemoveAt(i);
                    beat.Kill(player.transform.position.x < beat.GetPosForPlayer().x);
                }
            }

            if (!isDone && beatIndex == BeatData.beatTimes.Count)
            {
                isDone = true;
                Invoke("Fade", 3f);
            }
        }
    }