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); }
public NoteScore(NoteEvent noteEvent, double timestamp, NoteJudgeType judgeType) { this.noteEvent = noteEvent; this.timestamp = timestamp; this.judgeType = judgeType; }