New basic signs model

This commit is contained in:
Jerome Coudron
2023-05-07 21:00:52 +00:00
committed by Jelle De Geest
parent 06aa9206ac
commit 43887af670
111 changed files with 952 additions and 329 deletions

View File

@@ -586,18 +586,18 @@ public class HangmanController : AbstractMinigameController
/// </summary>
/// <param name="accuracy">The accuracy of the passed sign</param>
/// <param name="predictedSign">The name of the passed sign</param>
protected override void ProcessMostProbableSign(float accuracy, string predictedSign)
protected override void ProcessMostProbableSign(float distance, string predictedSign)
{
// Grab the threshold for the most probable letter
Learnable letter = fingerSpelling.learnables.Find((l) => l.name == predictedSign);
float threshold = letter.thresholdPercentage;
float threshold = letter.thresholdDistance;
// If there is a feedback-object, we wil change its appearance
if (feedbackText != null && feedbackProgressImage != null)
{
float oldValue = feedbackProgress.value;
// use an exponential scale
float newValue = Mathf.Exp(4 * (Mathf.Clamp(accuracy / threshold, 0.0f, 1.0f) - 1.0f));
float newValue = 1 - Mathf.Clamp(distance - threshold, 0.0f, 3.0f) / 3;
feedbackProgress.gameObject.Tween("FeedbackUpdate", oldValue, newValue, 0.2f, TweenScaleFunctions.CubicEaseInOut, (t) =>
{
if (feedbackProgress != null)
@@ -606,14 +606,14 @@ public class HangmanController : AbstractMinigameController
}
});
if (accuracy > threshold)
if (distance < threshold)
{
feedbackText.text = $"Herkent '{predictedSign}'";
Color green = new Color(139.0f / 255.0f, 212.0f / 255.0f, 94.0f / 255.0f);
feedbackText.color = green;
feedbackProgressImage.color = green;
}
else if (accuracy > threshold * 0.9)
else if (distance < threshold * 1.5)
{
feedbackText.text = $"Lijkt op '{predictedSign}'";
Color orange = new Color(242.0f / 255.0f, 127.0f / 255.0f, 12.0f / 255.0f);
@@ -629,7 +629,7 @@ public class HangmanController : AbstractMinigameController
}
}
// The logic for the internal workings of the game
if (accuracy > threshold)
if (distance < threshold)
{
// A different sign was predicted compared to the last call of this function
if (previousSign != predictedSign)