Resolve WES-144 "Feedback justsign"
This commit is contained in:
@@ -172,8 +172,31 @@ public partial class SpellingBeeController : AbstractFeedback
|
||||
/// </summary>
|
||||
protected string previousIncorrectSign = null;
|
||||
|
||||
/// <summary>
|
||||
/// Reference used to set the webcam for the SignPredictor
|
||||
/// </summary>
|
||||
public RawImage webcamScreen;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to display the score
|
||||
/// </summary>
|
||||
public TMP_Text scoreDisplay;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to display the points lost/won
|
||||
/// </summary>
|
||||
public TMP_Text scoreBonus;
|
||||
|
||||
/// <summary>
|
||||
/// Score obtained when spelling a letter
|
||||
/// </summary>
|
||||
private int correctLettersScore = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Score obtained when spelling the wrong letter :o
|
||||
/// </summary>
|
||||
private int incorrectLettersScore = -5;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
@@ -223,6 +246,9 @@ public partial class SpellingBeeController : AbstractFeedback
|
||||
words.AddRange(currentTheme.learnables);
|
||||
ShuffleWords();
|
||||
NextWord();
|
||||
|
||||
scoreDisplay.text = $"Score: {CalculateScore()}";
|
||||
scoreBonus.text = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -236,6 +262,7 @@ public partial class SpellingBeeController : AbstractFeedback
|
||||
if (bonusActiveRemaining <= 0.0 && bonusTimeText.activeSelf)
|
||||
{
|
||||
bonusTimeText.SetActive(false);
|
||||
scoreBonus.text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -277,7 +304,7 @@ public partial class SpellingBeeController : AbstractFeedback
|
||||
/// <returns>The calculated score</returns>
|
||||
public int CalculateScore()
|
||||
{
|
||||
return spelledWords * 5 + correctLetters;
|
||||
return correctLetters * correctLettersScore + incorrectLetters * incorrectLettersScore;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -378,7 +405,7 @@ public partial class SpellingBeeController : AbstractFeedback
|
||||
{
|
||||
timerValue += (float)seconds;
|
||||
bonusTimeText.SetActive(true);
|
||||
bonusActiveRemaining = 2.0f;
|
||||
bonusActiveRemaining = 1.0f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -394,11 +421,17 @@ public partial class SpellingBeeController : AbstractFeedback
|
||||
{
|
||||
correctLetters++;
|
||||
letters[letterIndex].GetComponent<Image>().color = new Color(0x8b / 255.0f, 0xd4 / 255.0f, 0x5e / 255.0f);
|
||||
scoreDisplay.text = $"Score: {CalculateScore()}";
|
||||
scoreBonus.text = $"+{correctLettersScore}";
|
||||
scoreBonus.color = new Color(0x8b / 255.0f, 0xd4 / 255.0f, 0x5e / 255.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
incorrectLetters++;
|
||||
letters[letterIndex].GetComponent<Image>().color = new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f);
|
||||
scoreDisplay.text = $"Score: {CalculateScore()}";
|
||||
scoreBonus.text = $"{incorrectLettersScore}";
|
||||
scoreBonus.color = new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f);
|
||||
}
|
||||
|
||||
do
|
||||
@@ -532,7 +565,7 @@ public partial class SpellingBeeController : AbstractFeedback
|
||||
|
||||
float oldValue = feedbackProgress.value;
|
||||
// use an exponential scale
|
||||
float newValue = Mathf.Exp(4 * (accCurrentSign - 1.0f));
|
||||
float newValue = Mathf.Exp(4 * (Mathf.Clamp(accCurrentSign / thresholdCurrentSign, 0.0f, 1.0f) - 1.0f));
|
||||
feedbackProgress.gameObject.Tween("FeedbackUpdate", oldValue, newValue, 0.2f, TweenScaleFunctions.CubicEaseInOut, (t) =>
|
||||
{
|
||||
if (feedbackProgress != null)
|
||||
@@ -548,7 +581,6 @@ public partial class SpellingBeeController : AbstractFeedback
|
||||
// Correct sign
|
||||
if (predictedSign == currentSign)
|
||||
{
|
||||
yield return new WaitForSeconds(1.0f);
|
||||
PredictSign(predictedSign);
|
||||
timer = DateTime.Now;
|
||||
predictedSign = null;
|
||||
|
||||
Reference in New Issue
Block a user