Added timer to SpellingBee to see when a sign is accepted. Times display -> accepted

This commit is contained in:
hvbreuge
2023-05-18 14:57:09 +02:00
parent b729981edf
commit 2736de811d

View File

@@ -170,6 +170,11 @@ public partial class SpellingBeeController : AbstractMinigameController
get { return fingerspelling; } get { return fingerspelling; }
} }
/// <summary>
/// Timer to keep track of how long a sign is performed
/// </summary>
protected DateTime acceptance_test_timer;
/// <summary> /// <summary>
/// Update is called once per frame /// Update is called once per frame
/// </summary> /// </summary>
@@ -280,6 +285,7 @@ public partial class SpellingBeeController : AbstractMinigameController
letterIndex++; letterIndex++;
} while (letterIndex < currentWord.Length && currentWord[letterIndex] == ' '); } while (letterIndex < currentWord.Length && currentWord[letterIndex] == ' ');
acceptance_test_timer = DateTime.Now;
// Change the color of the next letter or change to new word // Change the color of the next letter or change to new word
if (letterIndex < currentWord.Length) if (letterIndex < currentWord.Length)
{ {
@@ -377,6 +383,8 @@ public partial class SpellingBeeController : AbstractMinigameController
bool successful = sign.ToUpper() == currentWord[letterIndex].ToString().ToUpper(); bool successful = sign.ToUpper() == currentWord[letterIndex].ToString().ToUpper();
if (successful) if (successful)
{ {
// Timer acceptance test
Debug.Log(DateTime.Now - acceptance_test_timer);
AddSeconds(secondsPerLetter); AddSeconds(secondsPerLetter);
} }
NextLetter(successful); NextLetter(successful);
@@ -529,6 +537,9 @@ public partial class SpellingBeeController : AbstractMinigameController
scoreDisplay.text = $"Score: {CalculateScore()}"; scoreDisplay.text = $"Score: {CalculateScore()}";
scoreBonus.text = ""; scoreBonus.text = "";
// timer for acceptance test
acceptance_test_timer = DateTime.Now;
} }
/// <summary> /// <summary>