예제 #1
0
    void DequeueMissedBeats()
    {
        if (beats.Count == 0)
        {
            return;
        }
        BeatMovement beatMovement = beats.Peek().GetComponent <BeatMovement>();

        while (ConductorController.songPosition > beatMovement.GetTargetTime() + hitMargin)
        {
            beats.Dequeue();
            StartCoroutine(indicator.Flash(0));
            if (beats.Count == 0)
            {
                return;
            }
            beatMovement = beats.Peek().GetComponent <BeatMovement>();
        }
    }
예제 #2
0
    public void HitBeat()
    {
        if (beats.Count == 0)
        {
            return;
        }
        float        songPos      = ConductorController.songPosition;
        BeatMovement beatMovement = beats.Peek().GetComponent <BeatMovement>();
        float        targetTime   = beatMovement.GetTargetTime();

        if ((songPos > targetTime - hitMargin) && (songPos < targetTime + hitMargin))
        {
            // Hit!
            Destroy(beats.Dequeue());
            bool goodHit    = (songPos > targetTime - goodHitMargin) && (songPos < targetTime + goodHitMargin);
            bool perfectHit = goodHit && (songPos > targetTime - perfectHitMargin) && (songPos < targetTime + perfectHitMargin);
            StartCoroutine(indicator.Flash(perfectHit ? 3 : (goodHit ? 2 : 1)));
        }
    }