public virtual void UpdateScoring(InputState state, ScoreManager scoreManager) { //TODO currently a copy of SimpleNote: fix this! //obviously don't score if we've already scored this note if (Scored) { return; } double timeDelta = Math.Abs(state.Time - Time.Seconds); bool isEarly = Time.Seconds > state.Time; //late note out of scoring threshold: doesn't matter if there was input, this is a miss if (timeDelta > scoreManager.scoringThreshold && !isEarly) { scoreManager.onScoring(new Scoring(timeDelta, Scoring.Rank.Miss, this)); Scored = true; return; } //First, check we're in the input range if (!state.DownInRange(Position)) { return; } //We have a relevant 'down' event on our note. Let's see how well they did. //just for safety, disregard attempts that are out of the score threshold // (but only early hits; 'late' out of the scoring threshold means there was no attempt made to hit this note, and it can be counted as a miss. if (timeDelta > scoreManager.scoringThreshold && isEarly) { return; } //consider this change 'absorbed' state.AbsorbChangesInRange(Position); //now score this change based on the time delta. var scoring = scoreManager.GenerateScoring(state.Time, this); Hit = scoring.Ranking != Scoring.Rank.Miss; //finally, fire a scoring event. scoreManager.onScoring(scoring); Scored = true; }
public virtual void UpdateScoring(InputState state, ScoreManager scoreManager) { //TODO: big flaw in scoring: we're not counting misses when notes go out of range without being touched! //obviously don't score if we've already scored this note if (Scored) { return; } double timeDelta = Math.Abs(state.Time - Time.Seconds); bool isEarly = Time.Seconds > state.Time; //late note out of scoring threshold: doesn't matter if there was input, this is a miss if (timeDelta > scoreManager.scoringThreshold && !isEarly) { scoreManager.onScoring(new Scoring(timeDelta, Scoring.Rank.Miss, this)); Scored = true; return; } //First, check we're in the input range if (!state.DownInRange(Position)) { return; } //We have a relevant 'down' event on our note. Let's see how well they did. //just for safety, disregard attempts that are out of the score threshold // (but only early hits; 'late' out of the scoring threshold means there was no attempt made to hit this note, and it can be counted as a miss. if (timeDelta > scoreManager.scoringThreshold && isEarly) { return; } //consider this change 'absorbed' state.AbsorbChangesInRange(Position); //now score this change based on the time delta. var scoring = scoreManager.GenerateScoring(state.Time, this); Hit = scoring.Ranking != Scoring.Rank.Miss; //golden notes always marvelous if (Golden && Hit) { scoring.Ranking = Scoring.Rank.Marv; } //finally, fire a scoring event. scoreManager.onScoring(scoring); Scored = true; if (Hit) { _avgDeviation += state.Time - Time.Seconds; _deviationSamples++; if (_deviationSamples % 50 == 0) { Debug.Log("Average hit latency: " + (_avgDeviation / _deviationSamples) + " from " + _deviationSamples + " samples."); } } }