Ejemplo n.º 1
0
    private void OnBeatDone(Beat beat, bool isSuccess)
    {
        comboCount = isSuccess ? comboCount + 1 : 0;
        combo.SetCombo(comboCount);

        scoreCount += comboCount + (int)Mathf.Pow(comboCount, 2);
        string scoreString = scoreCount.ToString();

        while (scoreString.Length < 8)
        {
            scoreString = "0" + scoreString;
        }
        scoreText.text = scoreString;

        if (isSuccess)
        {
            player.MoveTo(beat.GetPosForPlayer());
        }
    }
Ejemplo n.º 2
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);
            }
        }
    }