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

@@ -265,27 +265,36 @@ public class HangmanPlaymodeTests
{
hangmanController.SinglePlayer();
hangmanController.ProcessSignForTests(1, "A");
hangmanController.ProcessSignForTests(0.001f, "A");
yield return new WaitForSeconds(0.2f);
// The sign for A has been held for 0.2f seconds...
Assert.IsTrue(hangmanController.getCurrentTime() >= 0.2f && hangmanController.getCurrentTime() <= 0.3f);
hangmanController.ProcessSignForTests(1, "B");
hangmanController.ProcessSignForTests(0.001f, "B");
yield return new WaitForSeconds(0.2f);
// The sign changed so the time needs to be at 0.2f again
Assert.IsTrue(hangmanController.getCurrentTime() >= 0.2f && hangmanController.getCurrentTime() <= 0.3f);
hangmanController.ProcessSignForTests(1 / 10, "B");
hangmanController.ProcessSignForTests(1000, "B");
yield return new WaitForSeconds(0.2f);
// The sign changed is below the threshold, time is no longer tracked
// The sign changed is way above the threshold, time is no longer tracked and is reset
Assert.IsTrue(hangmanController.getCurrentTime() == 0.0);
for (float i = 0; i < 1; i += 0.02f)
// Check that the time stays zero so long as the distance stays above the threshold
Learnable C = hangmanController.fingerSpelling.learnables.Find((l) => l.name == "C");
float threshold = C.thresholdDistance;
for (float i = 2 * threshold; i > threshold; i -= threshold / 6)
{
hangmanController.ProcessSignForTests(i, "C");
yield return new WaitForSeconds(0.01f);
Assert.IsTrue(hangmanController.getCurrentTime() == 0.0);
}
// Check that the time rises above zero when you dip just below the threshold
hangmanController.ProcessSignForTests(threshold - 0.01f, "C");
yield return new WaitForSeconds(0.01f);
Assert.IsTrue(hangmanController.getCurrentTime() > 0.0);
yield return null;
}
@@ -350,7 +359,8 @@ public class HangmanPlaymodeTests
{
while (hangmanController.getCurrentMode() != multiplayerConfirmInput)
{
hangmanController.ProcessSignForTests(1, letter);
// Choose the letter by giving it a very small distance
hangmanController.ProcessSignForTests(0.001f, letter);
yield return new WaitForSeconds(0.2f);
}
@@ -366,7 +376,8 @@ public class HangmanPlaymodeTests
{
while (!hangmanController.getUsedLetters().Contains(letter))
{
hangmanController.ProcessSignForTests(1, letter);
// Choose the letter by giving it a very small distance
hangmanController.ProcessSignForTests(0.001f, letter);
yield return new WaitForSeconds(0.2f);
}
}