Exemplo n.º 1
0
        public BeatObjectGrade React(bool activeReaction)
        {
            if (_reactIndex < beatObjectList.Count)
            {
                BeatObject currentBeat = beatObjectList[_reactIndex];
                float      difference  = currentBeat.beatTime - _audioSource.time;

                if (difference > okayTolerance)
                {
                    return(BeatObjectGrade.Waiting);
                }

                float           absDifference = Math.Abs(difference);
                BeatObjectGrade grade;

                if (activeReaction)
                {
                    if (absDifference < excellentTolerance)
                    {
                        grade = BeatObjectGrade.Excellent;
                    }
                    else if (absDifference < goodTolerance)
                    {
                        grade = BeatObjectGrade.Good;
                    }
                    else if (absDifference < okayTolerance)
                    {
                        grade = BeatObjectGrade.Okay;
                    }
                    else
                    {
                        grade = BeatObjectGrade.Miss;
                    }
                }
                else
                {
                    if (absDifference > okayTolerance)
                    {
                        grade = BeatObjectGrade.Miss;
                    }
                    else
                    {
                        grade = BeatObjectGrade.Waiting;
                    }
                }

                if (grade != BeatObjectGrade.Waiting)
                {
                    _reactIndex++;
                }

                currentBeat.SetGrade(grade);

                return(grade);
            }
            else
            {
                return(BeatObjectGrade.Inactive);
            }
        }
Exemplo n.º 2
0
        public BeatObject RequestDrawableBeat()
        {
            if (_drawIndex < beatObjectList.Count)
            {
                BeatObject beatObject = beatObjectList[_drawIndex];

                if (beatObject.shouldDraw(this))
                {
                    _drawIndex++;
                    return(beatObject);
                }
            }

            return(null);
        }