record accuracy for playthrough

This commit is contained in:
minenice55 2023-01-24 20:10:24 -05:00
parent 8b33e77791
commit b8df0d1a26
3 changed files with 17 additions and 4 deletions

View file

@ -203,9 +203,10 @@ namespace HeavenStudio
} }
} }
public static void ScoreInputAccuracy(double accuracy, float weight = 1) public void ScoreInputAccuracy(double accuracy, bool late, double weight = 1)
{ {
totalInputs += weight;
totalPlayerAccuracy += accuracy * weight;
} }
public void SeekAheadAndPreload(double start, float seekTime = 8f) public void SeekAheadAndPreload(double start, float seekTime = 8f)
@ -387,6 +388,10 @@ namespace HeavenStudio
canInput = true; canInput = true;
inputOffsetSamples.Clear(); inputOffsetSamples.Clear();
averageInputOffset = 0; averageInputOffset = 0;
totalInputs = 0;
totalPlayerAccuracy = 0;
StartCoroutine(PlayCo(beat)); StartCoroutine(PlayCo(beat));
onBeatChanged?.Invoke(beat); onBeatChanged?.Invoke(beat);
} }
@ -427,6 +432,7 @@ namespace HeavenStudio
KillAllSounds(); KillAllSounds();
Debug.Log($"Average input offset for playthrough: {averageInputOffset}ms"); Debug.Log($"Average input offset for playthrough: {averageInputOffset}ms");
Debug.Log($"Accuracy for playthrough: {(PlayerAccuracy * 100) : 0.00}");
if (playOnStart) if (playOnStart)
{ {

View file

@ -251,6 +251,11 @@ namespace HeavenStudio.Games
return null; return null;
} }
public void ScoreMiss(double weight)
{
GameManager.instance.ScoreInputAccuracy(0, true, weight);
}
private void OnDestroy() { private void OnDestroy() {
foreach (var evt in scheduledInputs) foreach (var evt in scheduledInputs)
{ {

View file

@ -165,9 +165,9 @@ namespace HeavenStudio.Games
GameManager.instance.AvgInputOffset = offset; GameManager.instance.AvgInputOffset = offset;
OnHit(this, (float) state); OnHit(this, (float) state);
if (countsForAccuracy && !(noAutoplay || autoplayOnly))
TimeToAccuracy(time);
CleanUp(); CleanUp();
if (countsForAccuracy && !(noAutoplay || autoplayOnly))
GameManager.instance.ScoreInputAccuracy(TimeToAccuracy(time), time > 1.0, 1.0);
} else } else
{ {
Blank(); Blank();
@ -233,6 +233,8 @@ namespace HeavenStudio.Games
} }
CleanUp(); CleanUp();
if (countsForAccuracy && !(noAutoplay || autoplayOnly))
GameManager.instance.ScoreInputAccuracy(0, true, 1.0);
} }
public void Blank() public void Blank()