Scoring System Preparation (#235)

* add calculation for accuracy

* record accuracy for playthrough

* implement forced miss scoring to some games
This commit is contained in:
minenice55
2023-01-24 22:54:19 -05:00
committed by GitHub
parent 4b13f559eb
commit a8b6f345a2
16 changed files with 171 additions and 62 deletions

View File

@ -60,6 +60,7 @@ namespace HeavenStudio
public static GameManager instance { get; private set; }
private EventCaller eventCaller;
// average input accuracy (msec)
List<int> inputOffsetSamples = new List<int>();
float averageInputOffset = 0;
public float AvgInputOffset
@ -75,6 +76,18 @@ namespace HeavenStudio
}
}
// input accuracy (%)
double totalInputs = 0;
double totalPlayerAccuracy = 0;
public double PlayerAccuracy
{
get
{
if (totalInputs == 0) return 0;
return totalPlayerAccuracy / totalInputs;
}
}
private void Awake()
{
// autoplay = true;
@ -190,6 +203,14 @@ namespace HeavenStudio
}
}
public void ScoreInputAccuracy(double accuracy, bool late, double weight = 1)
{
totalInputs += weight;
totalPlayerAccuracy += accuracy * weight;
// push the hit event to the timing display
}
public void SeekAheadAndPreload(double start, float seekTime = 8f)
{
//seek ahead to preload games that have assetbundles
@ -369,6 +390,10 @@ namespace HeavenStudio
canInput = true;
inputOffsetSamples.Clear();
averageInputOffset = 0;
totalInputs = 0;
totalPlayerAccuracy = 0;
StartCoroutine(PlayCo(beat));
onBeatChanged?.Invoke(beat);
}
@ -409,6 +434,7 @@ namespace HeavenStudio
KillAllSounds();
Debug.Log($"Average input offset for playthrough: {averageInputOffset}ms");
Debug.Log($"Accuracy for playthrough: {(PlayerAccuracy * 100) : 0.00}");
if (playOnStart)
{