mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:27:39 +02:00
Scoring System Preparation (#235)
* add calculation for accuracy * record accuracy for playthrough * implement forced miss scoring to some games
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user