示例#1
0
        private NoteScore GetClosestNote(double hitTimestamp, int lane, NoteJudgeType judgeType)
        {
            NoteScore closestNote = null;
            double    closestDiff = double.MaxValue;

            foreach (NoteScore noteScore in pendingNoteScores)
            {
                if (!judgeType.HasFlag(noteScore.judgeType))
                {
                    continue;
                }

                if (noteScore.noteEvent.lane != lane)
                {
                    continue;
                }

                double diff = Math.Abs(noteScore.timestamp - hitTimestamp);
                if (diff >= closestDiff)
                {
                    continue;
                }

                closestNote = noteScore;
                closestDiff = diff;
            }

            return(closestNote);
        }
示例#2
0
文件: NoteScore.cs 项目: xxami/Pulsus
 public NoteScore(NoteEvent noteEvent, double timestamp, NoteJudgeType judgeType)
 {
     this.noteEvent = noteEvent;
     this.timestamp = timestamp;
     this.judgeType = judgeType;
 }